Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2007
    Posts
    790
    Tokens
    3,429

    Latest Awards:

    Default Uploader Help +rep

    I'm experincing troubles with my uploader.

    Everytime i select an image and upload, it says:
    Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/junk/public_html/basic.php on line 88
    If you've got experince with EasyImageHoster then you'd know what i'm on about.

    www.JunkPalace.net - Try it yourself, see if it works.
    Might either be my hosting or my computer, not sure.

  2. #2
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    maybe post the code so we can help?

  3. #3
    Join Date
    Jan 2007
    Posts
    790
    Tokens
    3,429

    Latest Awards:

    Default

    HTML Code:
    <?
    // --------------------- (C) 2006 by TPAX --------------------- //
    // ------- PLEASE DO NOT REMOVE MY (C) FROM THE SCRIPT -------- // 
    // ------------------------- THANX :) ------------------------- //
    
    include "config.php";
    
    if (!isset($_FILES['userfile'])) exit;
    if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    if ($_FILES['userfile']['size']>$max_size) 
    { 
        echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File is too big !</font><br>\n"; exit; 
    }
    
    if (($_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg") || ($_FILES['userfile']['type']=="image/png")) 
    {
    
    // generate random signs
    $zufall = rand(1,9);
    $zufall2 = rand(1,26);
    $buchstaben = array(     "1" => "arx",
                    "2" => "opt",
                    "3" => "bwy",
                    "4" => "cqs",
                    "5" => "viu",
                    "6" => "rgh",
                    "7" => "jdv",
                    "8" => "klz",
                    "9" => "bfi", );
    
    $buchstaben2 = array(    "1" => "a",
                    "2" => "b",
                    "3" => "c",
                    "4" => "d",
                    "5" => "e",
                    "6" => "f",
                    "7" => "g",
                    "8" => "h",
                    "9" => "i",
                    "10" => "j",
                    "11" => "k",
                    "12" => "l",
                    "13" => "m",
                    "14" => "n",
                    "15" => "o",
                    "16" => "p",
                    "17" => "q",
                    "18" => "r",
                    "19" => "s",
                    "20" => "t",
                    "21" => "u",
                    "22" => "v",
                    "23" => "w",
                    "24" => "x",
                    "25" => "y",
                    "26" => "z", );
    
    $unikat = $buchstaben[$zufall] . time() . $buchstaben2[$zufall2];
    
    // upload progress
    $file = $_FILES['userfile']['name'];
    $new_bild = $unikat.substr($file, strrpos($file, "."));
    $res = move_uploaded_file($_FILES['userfile']['tmp_name'], "./" . $path . $new_bild);
    
    if (!$res) 
    { 
        echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Didn't work, please try again</font><br>\n"; exit; 
    } 
    
    else 
    {
    ?>
    <br>
    <?
    
    //set url variables
    $imgf = $new_bild;
    $thbf = $tpath.$imgf;
    $urlf = 'http://' .$domain .'/' .$path .$imgf;
    
    //create thumbnails
    function createthumb($name,$filename,$new_w,$new_h)
    {
    $system=explode('.',$name);
    
    if (preg_match('/jpg|jpeg|JPG/',$system[1]))
    {
        $src_img=imagecreatefromjpeg($name);
    }
    
    if (preg_match('/png|PNG/',$system[1]))
    {
        $src_img=imagecreatefrompng($name);
    }
    
    if (preg_match('/gif|GIF/',$system[1]))
    {
        $src_img=imagecreatefromgif($name);
    }
    
    $old_x=imageSX($src_img);
    $old_y=imageSY($src_img);
    
    if ($old_x > $old_y) 
    {
        $thumb_w=$new_w;
        $thumb_h=$old_y*($new_h/$old_x);
    }
    
    if ($old_x < $old_y) 
    {
        $thumb_w=$old_x*($new_w/$old_y);
        $thumb_h=$new_h;
    }
    
    if ($old_x == $old_y) 
    {
        $thumb_w=$new_w;
        $thumb_h=$new_h;
    }
    
    $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 
    
    if (preg_match("/png/",$system[1]))
    {
        imagepng($dst_img,$filename); 
    } 
    if (preg_match("/gif/",$system[1]))
    {
        imagegif($dst_img,$filename);
    }
    
    else 
    {
        imagejpeg($dst_img,$filename); 
    }
    
    imagedestroy($dst_img); 
    imagedestroy($src_img); 
    
    }
    
    createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize);
    ?>
    <head>
    <script type="text/javascript">
    <!--
    function highlight(field)
        {
        field.focus();
        field.select();
        }
    //-->
    </script>
    <title>JunkPalace.net - Host Your Images</title>
    </head>
    <body bgcolor="#272f80" background='background.gif'>
    <table align='center' border='0' cellpadding='2' cellspacing='2' width='740' bgcolor='white'>
    
    
    
    <link href="css.css" rel="stylesheet" type="text/css">
    </head>
    <body leftmargin="0" marginwidth="0">
    
    <table width="600" height="316" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
    	<tr>
    		<td height="94" colspan="3">
    			<img src="y1.gif" width="600" height="94" alt=""></td>
    	</tr>
    	<tr>
    		<td width="10" height="206" background="y2.gif">&nbsp;</td>
    		<td width="578" valign="top" background="y4.gif">
    
    <center>
    <table border='0' bgcolor='white'>
    <link rel="STYLESHEET" type="text/css" href="style.css">
    <FORM action="nowhere" method="post">
    <center>
    <tr><td>URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo 'http://' .$domain .'/' ?>viewer.php?id=<? echo $imgf; ?>"></td></tr>
    <tr><td>DIRECT URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo $urlf; ?>"></td></tr>
    <tr><td>HTML:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value='<a href="<? echo 'http://' .$domain .'/'; ?>viewer.php?id=<? echo $imgf; ?>"><img src="<? echo 'http://' .$domain.'/'.$tpath.$imgf; ?>" border="0"></a>'></td></tr>
    <tr><td>BBCode:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="[IMG]<? echo $urlf; ?>[/IMG]"></td></tr>
    <tr><td>IMAGE:</td><td><a href='viewer.php?id=<? echo $imgf; ?>'><img src='<? echo $thbf ?>'></a></td></tr>
    
    <?
    }
    } 
    
    else 
    { 
    echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">You selected a wrong filetype!</font><br>\n"; exit; 
    }
    
    }
    
    if ($tsize <= 380) 
    {
        echo "</table>";
        echo "<table border='0' bgcolor='white' width='457'>";
        echo "<tr><td><center><a href='./index.php'>Back</a></td></tr>";
        echo "</table>";
        echo "<br><br>";
        echo "</body>";
    }
    ?> 
    <td width="12" background="y.gif">&nbsp;</td>
    	</tr>
    	<tr>
    		<td height="16" colspan="3">
    			<img src="y3.gif" width="600" height="16" alt=""></td>
    	</tr>
    </table>

  4. #4
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    You didn't define $name like you did with the others? like
    PHP Code:
    $imgf $new_bild;
    $thbf $tpath.$imgf;
    $urlf 'http://' .$domain .'/' .$path .$imgf

  5. #5
    Join Date
    Jan 2007
    Posts
    790
    Tokens
    3,429

    Latest Awards:

    Default

    I don't get it.

    So what shall i put ?

  6. #6
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    im not good at php but try something like
    PHP Code:
    <?
    // --------------------- (C) 2006 by TPAX --------------------- //
    // ------- PLEASE DO NOT REMOVE MY (C) FROM THE SCRIPT -------- // 
    // ------------------------- THANX :) ------------------------- //

    include "config.php";

    if (!isset(
    $_FILES['userfile'])) exit;
    if (
    is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    if (
    $_FILES['userfile']['size']>$max_size

        echo 
    "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File is too big !</font><br>\n"; exit; 
    }

    if ((
    $_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg") || ($_FILES['userfile']['type']=="image/png")) 
    {

    // generate random signs
    $zufall rand(1,9);
    $zufall2 rand(1,26);
    $buchstaben = array(     "1" => "arx",
                    
    "2" => "opt",
                    
    "3" => "bwy",
                    
    "4" => "cqs",
                    
    "5" => "viu",
                    
    "6" => "rgh",
                    
    "7" => "jdv",
                    
    "8" => "klz",
                    
    "9" => "bfi", );

    $buchstaben2 = array(    "1" => "a",
                    
    "2" => "b",
                    
    "3" => "c",
                    
    "4" => "d",
                    
    "5" => "e",
                    
    "6" => "f",
                    
    "7" => "g",
                    
    "8" => "h",
                    
    "9" => "i",
                    
    "10" => "j",
                    
    "11" => "k",
                    
    "12" => "l",
                    
    "13" => "m",
                    
    "14" => "n",
                    
    "15" => "o",
                    
    "16" => "p",
                    
    "17" => "q",
                    
    "18" => "r",
                    
    "19" => "s",
                    
    "20" => "t",
                    
    "21" => "u",
                    
    "22" => "v",
                    
    "23" => "w",
                    
    "24" => "x",
                    
    "25" => "y",
                    
    "26" => "z", );

    $unikat $buchstaben[$zufall] . time() . $buchstaben2[$zufall2];

    // upload progress
    $file $_FILES['userfile']['name'];
    $new_bild $unikat.substr($filestrrpos($file"."));
    $res move_uploaded_file($_FILES['userfile']['tmp_name'], "./" $path $new_bild);

    if (!
    $res

        echo 
    "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Didn't work, please try again</font><br>\n"; exit; 


    else 
    {
    ?>
    <br>
    <?

    //set url variables
    $name $_POST[tmp_name];
    $imgf $new_bild;
    $thbf $tpath.$imgf;
    $urlf 'http://' .$domain .'/' .$path .$imgf;

    //create thumbnails
    function createthumb($name,$filename,$new_w,$new_h)
    {
    $system=explode('.',$name);

    if (
    preg_match('/jpg|jpeg|JPG/',$system[1]))
    {
        
    $src_img=imagecreatefromjpeg($name);
    }

    if (
    preg_match('/png|PNG/',$system[1]))
    {
        
    $src_img=imagecreatefrompng($name);
    }

    if (
    preg_match('/gif|GIF/',$system[1]))
    {
        
    $src_img=imagecreatefromgif($name);
    }

    $old_x=imageSX($src_img);
    $old_y=imageSY($src_img);

    if (
    $old_x $old_y
    {
        
    $thumb_w=$new_w;
        
    $thumb_h=$old_y*($new_h/$old_x);
    }

    if (
    $old_x $old_y
    {
        
    $thumb_w=$old_x*($new_w/$old_y);
        
    $thumb_h=$new_h;
    }

    if (
    $old_x == $old_y
    {
        
    $thumb_w=$new_w;
        
    $thumb_h=$new_h;
    }

    $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
    imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 

    if (
    preg_match("/png/",$system[1]))
    {
        
    imagepng($dst_img,$filename); 

    if (
    preg_match("/gif/",$system[1]))
    {
        
    imagegif($dst_img,$filename);
    }

    else 
    {
        
    imagejpeg($dst_img,$filename); 
    }

    imagedestroy($dst_img); 
    imagedestroy($src_img); 

    }

    createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize);
    ?>
    <head>
    <script type="text/javascript">
    <!--
    function highlight(field)
        {
        field.focus();
        field.select();
        }
    //-->
    </script>
    <title>JunkPalace.net - Host Your Images</title>
    </head>
    <body bgcolor="#272f80" background='background.gif'>
    <table align='center' border='0' cellpadding='2' cellspacing='2' width='740' bgcolor='white'>



    <link href="css.css" rel="stylesheet" type="text/css">
    </head>
    <body leftmargin="0" marginwidth="0">

    <table width="600" height="316" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
        <tr>
            <td height="94" colspan="3">
                <img src="y1.gif" width="600" height="94" alt=""></td>
        </tr>
        <tr>
            <td width="10" height="206" background="y2.gif">&nbsp;</td>
            <td width="578" valign="top" background="y4.gif">

    <center>
    <table border='0' bgcolor='white'>
    <link rel="STYLESHEET" type="text/css" href="style.css">
    <FORM action="nowhere" method="post">
    <center>
    <tr><td>URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo 'http://' .$domain .'/' ?>viewer.php?id=<? echo $imgf?>"></td></tr>
    <tr><td>DIRECT URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo $urlf?>"></td></tr>
    <tr><td>HTML:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value='<a href="<? echo 'http://' .$domain .'/'?>viewer.php?id=<? echo $imgf?>"><img src="<? echo 'http://' .$domain.'/'.$tpath.$imgf?>" border="0"></a>'></td></tr>
    <tr><td>BBCode:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="[IMG]<? echo $urlf?>[/IMG]"></td></tr>
    <tr><td>IMAGE:</td><td><a href='viewer.php?id=<? echo $imgf?>'><img src='<? echo $thbf ?>'></a></td></tr>

    <?
    }


    else 

    echo 
    "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">You selected a wrong filetype!</font><br>\n"; exit; 
    }

    }

    if (
    $tsize <= 380
    {
        echo 
    "</table>";
        echo 
    "<table border='0' bgcolor='white' width='457'>";
        echo 
    "<tr><td><center><a href='./index.php'>Back</a></td></tr>";
        echo 
    "</table>";
        echo 
    "<br><br>";
        echo 
    "</body>";
    }
    ?> 
    <td width="12" background="y.gif">&nbsp;</td>
        </tr>
        <tr>
            <td height="16" colspan="3">
                <img src="y3.gif" width="600" height="16" alt=""></td>
        </tr>
    </table>]

  7. #7
    Join Date
    Jan 2007
    Posts
    790
    Tokens
    3,429

    Latest Awards:

    Default

    I've just found out that it's not just happened to me, it's also happening same thing with www.y3d.co.uk and i think it's just a common error and happens sometimes. Thanks for help anyway +rep =]
    Last edited by Isolde; 22-02-2007 at 11:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •