#29398 [Opn->Bgs]: Unable to allocate memory with big jpeg files

From: Date: Tue, 27 Jul 2004 09:30:54 +0000
Subject: #29398 [Opn->Bgs]: Unable to allocate memory with big jpeg files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-63611@lists.php.net to get a copy of this message
ID: 29398 Updated by: tony2001@php.net Reported By: speps84 at hotmail dot com -Status: Open +Status: Bogus Bug Type: GD related Operating System: Windows XP PHP Version: 5.0.0 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-07-26 23:26:38] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29398&edit=1

« previous php.bugs (#63611) next »