GD 黑色图像
我正在尝试创建较大图像的缩略图/剪切图,它在很大一部分时间都有效,但时不时地我会得到以下信息:
Warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Corrupt
JPEG data: 626 extraneous bytes before marker 0xd9 in code.php on line 5
这是“code.php”的第 5 行:
$srcImg = imagecreatefromjpeg('5f48ecb107a1e297d23392f703992d60.jpg');
图像在中显示良好Windows 但 gd 无法创建资源,所以我最终得到一个空白图像(剪切部分应该在的位置)。
作为参考框架,这是关于汽车标题的,系统有 2784 个有效的,只有 36 个不起作用,所以没什么大不了的,但它激起了我的好奇心。
I'm trying to create a thumbnail / cutout of a larger image and it works for a large percentage of the time but every now and again I get the following:
Warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Corrupt
JPEG data: 626 extraneous bytes before marker 0xd9 in code.php on line 5
This is line 5 of "code.php":
$srcImg = imagecreatefromjpeg('5f48ecb107a1e297d23392f703992d60.jpg');
The image displays fine in windows but gd just fails to create the resource so I end up with a blank image (where the cutout section was supposed to go).
For frame of reference this is with regard to car titles and the system has 2784 that worked and only 36 that didn't so not a big deal but it has my curiosity piqued.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来很像另一个网站上报告的此问题站点,PHP bug 是 Ticket #29878 (我检查时不可用) 。
尽管您还应该验证图像文件是否是有效的、未损坏的 JPEG 图像文件。 ImageMagick 的
identify
程序可以识别文件是否损坏。一个潜在的问题是 JPEG 文件使用 CYMK 而不是 RGB 颜色图。如果图像损坏,ImageMagick 还可以让您将图像重新保存到有效的 JPEG 文件中。It sounds much like this problem reported on another web site, and the PHP bug is ticket #29878 (unavailable when I checked).
Although you should also verify that the image file is a valid, non-corrupt, JPEG image file as well. ImageMagick's
identify
program can identify if the file is corrupt. One potential problem is a JPEG file that uses CYMK rather than RGB colormap. ImageMagick can also likely let you resave the image to a valid JPEG file if corrupted.