Bug #72404 [Asn]: imagecreatefromjpeg fails on selfie
| From: | cmb@php.net | Date: | Wed, 15 Jun 2016 12:04:32 +0000 |
| Subject: | Bug #72404 [Asn]: imagecreatefromjpeg fails on selfie | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201648@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72404&edit=1
ID: 72404
Updated by: cmb@php.net
Reported by: opajaap at opajaap dot nl
Summary: imagecreatefromjpeg fails on selfie
Status: Assigned
Type: Bug
Package: GD related
Operating System: SunOS localhost 5.10 Generic_142
PHP Version: Irrelevant
Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
I've submitted a respective PR:
<https://github.com/php/php-src/pull/1945>.
Previous Comments:
------------------------------------------------------------------------
[2016-06-15 11:05:29] pajoye@php.net
Go ahead for 7.1+
------------------------------------------------------------------------
[2016-06-15 09:57:51] cmb@php.net
Fine, and thanks for the quick feedback.
@pierre Wouldn't it make sense to ignore those warnings by
*default* (i.e. gd.jpeg_ignore_warning=1)? As I understand it,
that is the default in libgd, see
<https://github.com/libgd/libgd/blob/gd-2.2.1/src/gd_jpeg.c#L413-L416>.
------------------------------------------------------------------------
[2016-06-15 09:13:02] opajaap at opajaap dot nl
Thank you.
ini_set( 'gd.jpeg_ignore_warning', true );
is an acceptable workaround.
Orientation is not a problem, I can handle exif and orientations.
------------------------------------------------------------------------
[2016-06-15 00:02:46] cmb@php.net
Setting gd.jpeg_ignore_warning=1 in php.ini solved the problem
that the JPEG couldn't be read. Please verify this[1].
If that works, you'll find that the image is bottom up when read
by GD. That is because the image data are stored that way, and the
Exif Orientation flag is supposed to signal a reader that the
image has to rotated by 180° (its value is 3[2][3]). However, GD
is not supposed to regard Exif data, so you'd have to rotate the
image yourself if necessary.
[1] <http://php.net/manual/en/image.configuration.php#ini.image.jpeg-ignore-warning>
[2] <http://php.net/manual/en/function.exif-read-data.php>
[3] <http://sylvana.net/jpegcrop/exif_orientation.html>
------------------------------------------------------------------------
[2016-06-14 15:57:17] cmb@php.net
Thanks for the link. Calling imagecreatefromjpeg() on this image
gives me an additional warning:
> imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
> Invalid SOS parameters for sequential JPEG
Have to investigate further.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72404
--
Edit this bug report at https://bugs.php.net/bug.php?id=72404&edit=1