Mark82 Posted December 17, 2006 Share Posted December 17, 2006 Hi, I have been trying to generate thumbnails automatically using a script form the net.I keep getting the error message "Call to undefined function imagecreatefromjpeg()" when I run the script.Im using PHP on localhost on ym own machine, using apache.I have Php 5.1 installed, and I've edited my php.ini file so that the php_gd2.dll is enabled.But when I run phpinfo I dont get anything on GD apart fomr right at the top where it says:"with-gd=shared" next to the configure command row.Can anyone help me? Have I dont something really stupid, not used GD before but form what Ive read Ive done everything to enable it, it comes bundled with my php version doesnt it?any help much appreicated! Quote Link to comment Share on other sites More sharing options...
True`Logic Posted March 2, 2007 Share Posted March 2, 2007 I'm having the exact same problem, php_gd2.dll is present in my extension_dir, and i have uncommented ;extension=php_gd2.dll, but gd functions do not work for me..Fatal error: Call to undefined function imageCreateFromJpeg() in E:\htdocs\test.php on line 16though the code is irrelevant to the problem at hand I'll post the code anyway (it's directly from php.net as a reference to get started learnign gd functions)[code]<?php$src_file = 'source.jpg';list($src_w, $src_h, $src_t, $src_a) = getimagesize($src_file);$ptr_file = 'pointer.png'; // must have no transparency, but white backgroundlist($ptr_w, $ptr_h, $ptr_t, $ptr_a) = getimagesize($ptr_file);// destination image dimensions:$dst_w = 400;$dst_h = 200;// pointer position:$ptr_x = 195;$ptr_y = 70;$srcImage = imageCreateFromJpeg($src_file) or die ('failed imageCreateFromJpg');$dstImage = imageCreateTrueColor($dst_w, $dst_h) or die ('failed imageCreateTrueColor');imageCopyResampled($dstImage, $srcImage, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h) or die ('failed imageCopyResampled');$ptrImage = imageCreateFromPng($ptr_file) or die ('failed imageCreateFromPng');$ptr_white = imageColorAllocate($ptrImage,255,255,255);imageColorTransparent($ptrImage,$ptr_white);imageCopyMerge($dstImage, $ptrImage, $ptr_x, $ptr_y, 0, 0, $ptr_w, $ptr_h, 100) or die ('failed imageCopyMerge');imageJpeg($dstImage,'',100) or die ('failed imageJpeg');imageDestroy($srcImage) or die ('failed imageDestroy(1)');imageDestroy($dstImage) or die ('failed imageDestroy(2)');imageDestroy($ptrImage) or die ('failed imageDestroy(3)');?>[/code] Quote Link to comment Share on other sites More sharing options...
True`Logic Posted March 2, 2007 Share Posted March 2, 2007 the Modify button seems to have vanished from my previous psot so please excuse the doubble post..P.S.:before the obvious "answers" come in, I have uncommented the line, i have restarted the webserver, there are no extra gd2.dlls, i only have 1 php.ini on my comp, and no gd doesnt show up in phpinfo();, also gd_info is an undefined function. the extension_dir is correct and php_gd2.dll does exist in the extension dirhope you can help :(-Logic 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.