PHP Version 4.0.2
ImageCreateFromJPEG fails when I try to create a JPEG image from a URL. The function works fine when I try it with the same exact image stored locally. I can't find any mention of this in the bugs DB or on the mailing lists.
Here are the values for GD from phpinfo():
GD Support enabled
GD Version 1.6.2 or higher
PNG Support enabled
JPG Support enabled
WBMP Support enabled
Hopefully, I'm just doing something wrong:
* BEGIN CODE *
<?php
$URLImage = "http://www.apple.com/macosx/images/top_osx_beta_folder.jpg";
$localImage = "top_osx_beta_folder.jpg";
if (!$srcImg = ImageCreateFromJPEG($URLImage)) {
echo "Couldn't create image identifier from file \"$URLImage\".<BR>\n";
echo "image: \"$srcImg\"<BR>\n";
} else {
echo "Successful! Created image identifier from file \"$URLImage\"!<BR>\n";
echo "image: \"$srcImg\"<BR>\n";
}
echo "<BR>\n";
if (!$srcImg = ImageCreateFromJPEG($localImage)) {
echo "Couldn't create image identifier from file \"$localImage\".<BR>\n";
echo "image: \"$srcImg\"<BR>\n";
} else {
echo "Successful! Created image identifier from file \"$localImage\"!<BR>\n";
echo "image: \"$srcImg\"<BR>\n";
}
?>
* END CODE *
This is the output the code gives me:
* BEGIN OUTPUT *
Couldn't create image identifier from file "http://www.apple.com/macosx/images/top_osx_beta_folder.jpg".
image: ""
Successful! Created image identifier from file "top_osx_beta_folder.jpg"!
image: "Resource id #1"
* END OUTPUT *
Try it for yourself. Let me know what you find out and if you have a fix. This also happens for the ImageCreateFromPNG function.
Thanks for your time,
-David King