php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26231 Memory errors with createimagefromjpeg
Submitted: 2003-11-12 21:36 UTC Modified: 2003-11-13 19:37 UTC
From: mike at blueroot dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
 [2003-11-12 21:36 UTC] mike at blueroot dot net
Description:
------------
When trying to create a gd image resource from this jpeg http://www.blueroot.net/~mike/wrc2003/dscf0216.jpg I get this error

Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 6400 bytes) in /home/mike/public_html/wrc2003/test.php on line 5

The file is 778061 bytes.

This only happens with certain jpegs (straight from my camera), pictures that have been through gimp open perfectly.

# file ./dscf0216.jpg
./dscf0216.jpg: JPEG image data, EXIF standard 0.77, 42 x 0

this is the output from 'file' on the problem file.



Reproduce code:
---------------
$im = imagecreatefromjpeg("./dscf0216.jpg");

online here 

http://www.blueroot.net/~mike/wrc2003/test.php

Expected result:
----------------
Nothing (eg. no error)

Actual result:
--------------
Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 6400 bytes) in /home/mike/public_html/wrc2003/test.php on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-13 19:37 UTC] iliaa@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

Opening images is a memory intensive operation, just because the file may appear to be small, it does not mean it's memory foot print is. If you manipulate images you should increase your memory limit to 20-30 megabytes to avoid these problems.
 [2004-02-23 04:53 UTC] php at klieder dot nt
if this is not a bug, why does php 4.3.4 crash on this 
situation?
it totally died and can't be accessed anymore..

[Mon Feb 23 10:50:29 2004] [error] PHP Fatal error:  
Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 6400 bytes) in /home/login16/meetingrooms/
gz.functions.php on line 902
[Mon Feb 23 10:50:29 2004] [error] PHP Fatal error:  
Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 44 bytes) in Unknown on line 0
 [2004-02-23 05:12 UTC] php at klieder dot net
ignore my last comment..

but I couldn't find anything in the documentation about 
it, except in the users comments.. looks like a bad jpg 
file..

and looks like my browser is making some complains about 
it, and it won't display the site anymore, that's why I 
thought php was crashed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 22:01:26 2024 UTC