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

From: Date: Tue, 27 Jul 2004 18:16:38 +0000
Subject: #29398 [Bgs]: Unable to allocate memory with big jpeg files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-63637@lists.php.net to get a copy of this message
ID: 29398 User updated by: speps84 at hotmail dot com Reported By: speps84 at hotmail dot com Status: Bogus Bug Type: GD related Operating System: Windows XP PHP Version: 5.0.0 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-07-27 11:30:52] 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-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 (#63637) next »