oseawey / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Patch for /trunk/timthumb.php #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This would prevent timthumb from setting the memory limit to a lower total if 
the server is using a value above 30M already

Original issue reported on code.google.com by jadw...@gmail.com on 26 May 2011 at 12:37

Attachments:

GoogleCodeExporter commented 9 years ago
A "nicer" one would be:

if (return_bytes(ini_get('memory_limit'))<3145728) {
 // set memory limit to be able to have enough space to resize larger images
 ini_set ('memory_limit', MEMORY_LIMIT);
}

function return_bytes ($size_str)
{
    switch (substr ($size_str, -1))
    {
        case 'M': case 'm': return (int)$size_str * 1048576;
        case 'K': case 'k': return (int)$size_str * 1024;
        case 'G': case 'g': return (int)$size_str * 1073741824;
        default: return $size_str;
    }
}

but that's a bit verbose

Original comment by jadw...@gmail.com on 26 May 2011 at 12:46

GoogleCodeExporter commented 9 years ago
Nice one guys. Incorporated your code and it's in the repo now. 

Original comment by mmaun...@gmail.com on 7 Aug 2011 at 2:01