madhukar_garg Posted July 5, 2007 Share Posted July 5, 2007 Hi, please help me i am getting this error: Fatal error: Call to undefined function: imagecreatefromjpeg() in resize.php on line 33 thanks Madhukar Garg Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 5, 2007 Share Posted July 5, 2007 can i please see the resize.php? Quote Link to comment Share on other sites More sharing options...
madhukar_garg Posted July 5, 2007 Author Share Posted July 5, 2007 Hi Billy, Thanks for your reply, here is my code for resize.php <?php //stop direct access defined( '_VALID_MOS' ) or die( 'Restricted access.' ); //IMAGE RESIZE FUNCTION FOLLOW ABOVE DIRECTIONS function makeimage($filelocation,$filename,$newfilename,$path,$newwidth,$newheight) { //SEARCHES IMAGE NAME STRING TO SELECT EXTENSION (EVERYTHING AFTER . ) $image_type = strstr($filename, '.'); //SWITCHES THE IMAGE CREATE FUNCTION BASED ON FILE EXTENSION switch($image_type) { case '.jpg': $source = imagecreatefromjpeg($filelocation); break; case '.jpeg': $source = imagecreatefromjpeg($filelocation); break; case '.JPG': $source = imagecreatefromjpeg($filelocation); break; case '.JPEG': $source = imagecreatefromjpeg($filelocation); break; case '.png': $source = imagecreatefrompng($filelocation); break; case '.PNG': $source = imagecreatefrompng($filelocation); break; case '.gif': $source = imagecreatefromgif($filelocation); break; case '.GIF': $source = imagecreatefromgif($filelocation); break; default: echo("Error: Invalid Image Type"); die; break; } //CREATES THE NAME OF THE SAVED FILE $file = $newfilename . strtolower($filename); //CREATES THE PATH TO THE SAVED FILE $fullpath = $path . $file; //FINDS SIZE OF THE OLD FILE list($width, $height) = getimagesize($filelocation); //CREATES IMAGE WITH NEW SIZES $thumb = imagecreatetruecolor($newwidth, $newheight); //RESIZES OLD IMAGE TO NEW SIZES imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //SAVES IMAGE AND SETS QUALITY || NUMERICAL VALUE = QUALITY ON SCALE OF 1-100 imagejpeg($thumb, $fullpath, 85); //CREATING FILENAME TO WRITE TO DATABSE $filepath = $fullpath; //RETURNS FULL FILEPATH OF IMAGE ENDS FUNCTION return $filepath; } ?> Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 5, 2007 Share Posted July 5, 2007 when you use $filelocation do you include the name and ext of the image? Quote Link to comment Share on other sites More sharing options...
madhukar_garg Posted July 5, 2007 Author Share Posted July 5, 2007 yes, actually the problem is with GD support. i have enable extension=php_gd2.dll. but still its not working. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 5, 2007 Share Posted July 5, 2007 i dont know if this makes any difference but i would try using the code like ImageCreateFromGif this is what i do on my site Quote Link to comment Share on other sites More sharing options...
madhukar_garg Posted July 5, 2007 Author Share Posted July 5, 2007 you can take reference from resize.php try imagecreatefromjpeg() function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.