weird problem with imagecreatefromjpeg()
I have a very weird problem, i am importing a product list into a new website from csv. One part is to copy the image and resize it, but i am having a very weird problem with it.
$path = $_SERVER['DOCUMENT_ROOT']."/production/public/storage/Productimages/".$product['largepic'];
echo $path;
imagecreatefromjpeg($path);
If i execute this part I am getting this error:
/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/1A(19).jpg
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/xxxx/domains/xxxx/public_html/production/public/import.php on line 27
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/' is not a valid JPEG file in /home/xxxx/domains/xxxx/public_html/production/public/import.php on line 27
But when i copy the full path that i am echoing:
/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/1A(19).jpg
And use that like this:
imagecreatefromjpeg("/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/1A(19).jpg");
Then it works!?
I hope someone开发者_开发知识库 can help :(
Try the following snippet and see if it works.
$path = (string) $_SERVER['DOCUMENT_ROOT']."/production/public/storage/Productimages/".$product['largepic'];
echo $path;
imagecreatefromjpeg($path);
It could be problem with charset.
精彩评论