note 56032 added to function.imagecreatefromjpeg

From: Date: Sun, 21 Aug 2005 11:15:51 +0000
Subject: note 56032 added to function.imagecreatefromjpeg
Groups: php.notes 
Request: Send a blank email to php-notes+get-93985@lists.php.net to get a copy of this message
Estimated memory needed for ImageCreateFromJPEG First I supposed simple width*height*bpp will be enough, it isn't though; there is some pretty big overhead. $imageInfo = GetImageSize($imageFilename); $memoryNeeded = Round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + Pow(2, 16)) * 1.65); With memory_limit enabled running out of memory causes script to crash; above written will tel you how much memory you're gonna need for creating an image-resource out of image-file. So in conjunction with Memory_Get_Usage() and Get_CFG_Var('memory_limit') you can avoid the mentioned ending. (Yet there won't be too many images blocked from processing that would still fit in the memory, as the results of this are pretty accurate.) ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatefromjpeg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56032 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56032&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56032&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93985) next »