php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29398 Unable to allocate memory with big jpeg files
Submitted: 2004-07-26 23:26 UTC Modified: 2004-07-27 20:16 UTC
From: speps84 at hotmail dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.0.0 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: speps84 at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-07-26 23:26 UTC] speps84 at hotmail dot com
Description:
------------
I wrote a script that uses GD to slice big jpeg files (about 50mb, 21600x21600) into small 100x100 jpeg.
To make this, I have to open these big files and I use the function imagecreatefromjpeg.
While loading (HDD is working), I receive this error:

FATAL: emalloc(): Unable to allocate 86400 bytes

I have tested different values of memory_limit in php.ini ( and with --enable-memory-limit) even the unlimited value of -1: always the same error.

This error happens only with very big jpeg files (37mb and 47mb), not with about 4mb jpeg.

Reproduce code:
---------------
Launching PHP in Command Line mode under Windows XP:

php "myscript.php" --enable-debug --enable-memory-limit

The PHP Code is very simple :

$img = imagecreatefromjpeg("bigfile.jpg");



Expected result:
----------------
Opening of the image.

Actual result:
--------------
FATAL: emalloc(): Unable to allocate 86400 bytes

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-27 11:30 UTC] tony2001@php.net
GD lib needs lots of memory to store the image converted to it's internal format, which is very memory consumpting. 
So GD just don't have enough memory to do it.
Use console tools (ImageMagick for example) to work with such a large files, this is not a PHP bug.

 [2004-07-27 20:16 UTC] speps84 at hotmail dot com
Thank you but I tried the PHP extension for imagick and the opening of my jpeg files didn't work (it did with smaller files).
Does someone know any software that can handle such big files ? Thx.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 10 14:01:33 2024 UTC