#36726 [Bgs]: imagecreatefromjpeg() crahes PHP
| From: | pajoye@php.net | Date: | Mon, 20 Mar 2006 22:26:08 +0000 |
| Subject: | #36726 [Bgs]: imagecreatefromjpeg() crahes PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94683@lists.php.net to get a copy of this message | ||
ID: 36726
Updated by: pajoye@php.net
Reported By: christoph at ziegenberg dot com
Status: Bogus
Bug Type: GD related
Operating System: Suse Linux 9.3
PHP Version: 5.1.2
Assigned To: pajoye
New Comment:
"I only want to add (for other users) that all images are 24 Bit = 3
Byte per pixel"
No. GD True color buffer uses *four* bytes, red, green, blue and alpha,
and *always* :-)
Previous Comments:
------------------------------------------------------------------------
[2006-03-20 22:58:32] christoph at ziegenberg dot com
Thanks a lot, I understand what you mean.
I only want to add (for other users) that all images are 24 Bit = 3
Byte per pixel, so the calculation isn't as simple as that (to multiply
the dimension and channel values from getimagesize()).
------------------------------------------------------------------------
[2006-03-20 22:34:03] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
the file size of a JPEG data has nothing to do with the size of the
*uncompressed* pixel data in memory.
For example, your images is 1600x1200, true colors (4bytes per pixel):
== 7680000 bytes
add to that the whole memory that your script or php may need and you
are out of the 8M.
Now please, keep this bug as closed as there is obviously no bug. If
you need support feel free to use our numerous support possibilies.
------------------------------------------------------------------------
[2006-03-20 22:28:46] christoph at ziegenberg dot com
Bye the way: I added the additional information to the phpinfo() output
with the error_reporting, memory_limit,... settings.
------------------------------------------------------------------------
[2006-03-20 22:22:41] christoph at ziegenberg dot com
Thanks, got the reason... error_reporting was active, but
display_errors wasn't and the error has not been logged. I changed it
and got the following error for image 18925.jpg:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 1600 bytes)
I didn't expect that PHP needs so much memory for an image less than
200 KB - and I do NOT think that this is a normal behaviour, because
there are much larger images (e.g. the new test image "99992.jpg" with
about 1.5 MB) which work fine with the recommended value 8M... Changing
it to 16M works for all images.
I think that this error should not occur for the mentioned example
image and that there is an error with the image processing wasting all
the memory. So I changed this bug again to open... hope you agree.
------------------------------------------------------------------------
[2006-03-20 21:05:35] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
21839.jpg:
Warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
Corrupt JPEG data: 121 extraneous bytes before marker 0xd9
7737.jpg:
Warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
Corrupt JPEG data: 135 extraneous bytes before marker 0xd9
These two jpeg images are not valid. From php 5.1.3 (try using
snapshot.php.net 5.1.x), you can ignore the warnings or minor errors
using this command:
ini_set("gd.jpeg_ignore_warning", true);
I set to "expected behavior". By the way, you should use
error_reporting(E_ALL); when you develop.
------------------------------------------------------------------------
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
http://bugs.php.net/36726
--
Edit this bug report at http://bugs.php.net/?id=36726&edit=1