imagecreatefromjpeg() 的奇怪问题
我有一个非常奇怪的问题,我正在将 csv 中的产品列表导入到新网站中。 一部分是复制图像并调整其大小,但我遇到了一个非常奇怪的问题。
$path = $_SERVER['DOCUMENT_ROOT']."/production/public/storage/Productimages/".$product['largepic'];
echo $path;
imagecreatefromjpeg($path);
如果我执行这部分,我会收到此错误:
/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
但是当我复制我正在回显的完整路径时:
/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/1A(19).jpg
并像这样使用它:
imagecreatefromjpeg("/home/xxxx/domains/xxxx/public_html/production/public/storage/Productimages/1A(19).jpg");
然后它可以工作!?
我希望有人能帮忙:(
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 :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下代码片段,看看它是否有效。
可能是字符集问题。
Try the following snippet and see if it works.
It could be problem with charset.