Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined function imagecreatefromjpg 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
This is a code snippet from a picture resize script which I use on multiple domains.
Code:
$src_img = ImageCreateFromJPEG($img_name);
$thumb = ImageCreateTrueColor($new_width,$new_height);
ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width),($new_height),$size[0],$size[1]);
ImageJPEG($thumb);
ImageDestroy($src_img);
ImageDestroy($thumb);
On 1 particular domain, it throws the following error
Code:
Fatal error: Call to undefined function: imagecreatefromjpg
All the other GD functions are accepted, any clue why this one should cause a problem?


Keith
 
The function is imagecreatefromjp[!]e[/!]g

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Hit submit too soon

The code snippet you show uses the proper function name (though I'm unsure about the caps). But the error shows imagecreatefromjpg (with no 'e' on the jpeg).

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
check your code again. you would not get that error had you not typed jpg
 
Sorry - I pasted the wrong error message into the forum.
I think I may have assumed too much about the script.
It appears that it bombs out on the first error it encounters. When I comment them out in turn, it fails on the next GD function.
How can I check if the GD lib is installed?

Keith
 
create a page that has phpinfo() as the sole instruction.

Put it on the server in question and visit it.
You should see a big list of information about the server and what's installed.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
or you could try gd_info() [blush]

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Thanks for that.
There is no mention of GD anywhere there and the gd_info() crashes. I assume that gd_info() would only be present if it was installed.
Is it classed as a library or module in PHP speak?

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top