Jump to content

GD Library problem


Mark82

Recommended Posts

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!
Link to comment
Share on other sites

  • 2 months later...
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 16

though 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 background
list($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]
Link to comment
Share on other sites

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 dir

hope you can help :(

-Logic
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.