jawadi121 / smart-lencioni-image-resizer

Automatically exported from code.google.com/p/smart-lencioni-image-resizer
GNU General Public License v3.0
0 stars 0 forks source link

Dynamic memory usage. #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Instead of having a fixed amount allocated for each request I suggest the 
following code to be added:

// get image size of img

$x = @getimagesize($img);
//multiply width per height per 4 bytes.
$estimatedMemory = $x[0] * $x[1] * 4;
//convert memory to Megabyte and add 10 in order to allow some slack
$estimatedMemory = round(($estimatedMemory/1024)/1024,0)+10;

$v = ini_set('memory_limit', "$estimatedMemory"."M");

Original issue reported on code.google.com by ifhost...@gmail.com on 26 Nov 2010 at 1:58

GoogleCodeExporter commented 9 years ago

Original comment by joe.lencioni on 16 Dec 2010 at 3:06

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r120.

Original comment by joe.lencioni on 21 Dec 2010 at 4:22