|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-23 12:31 UTC] dtra at faceyoursfears dot com
[2005-11-23 12:37 UTC] tony2001@php.net
[2005-11-23 13:58 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 09:00:01 2025 UTC |
Description: ------------ i am just trying to resize an image on my computer, using the gd library, imagecreatefrompng gives me this errorFatal i have 777 chmodded all directories and files gd is the bundled gd library installed as a shared module imagecreatefromjpeg, using exactly the same code works fine './configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-mysqli' additional ini files parsed /etc/php.d/dom.ini, /etc/php.d/ffmpeg.ini, /etc/php.d/gd.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/soap.ini, /etc/php.d/xsl.ini ----added to php.ini------- [mime_magic] mime_magic.debug = 1 mime_magic.magicfile = "/usr/share/file/magic.mime" Reproduce code: --------------- $file = '/path/to/Screenshot.png'; $path = '/var/www/html/images/temp.png'; $type = mime_content_type($file); $i = imagecreatefrompng($file); list($width, $height) = getimagesize($file); if ($width > $height) $scale = $width / 260; else $scale = $height / 240; $imgWidth = round($width/$scale, 0); $imgHeight = round($height/$scale, 0); $newI = imagecreatetruecolor($imgWidth, $imgHeight); $bgColor = imagecolorallocate($newI, 51, 85, 204); imagefilledrectangle($newI, 0, 0, $imgWidth, $imgHeight, $bgColor); imagecopyresampled($newI, $i, 0, 0, 0, 0, $imgWidth, $imgHeight, $width, $height); if ($type == 'image/jpeg') imagejpeg($finalImg, $path, 70); else if ($type == 'image/x-png' || $type == 'image/png') imagepng($finalImg, $path, 70); header('Content-type: image/png'); imagepng($path); Expected result: ---------------- prints the newly resized and created image to the screen Actual result: -------------- error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 5242880 bytes) in /var/www/html/tmp/png-img.php on line 5