[RCD] Image resizing - Memory exhaustion
h.reindl at thelounge.net
Sat May 17 12:07:52 CEST 2014
Am 17.05.2014 11:59, schrieb Rosali:
>>>> Allowed memory size of 67108864 bytes exhausted (tried to allocate 19276
>>>> bytes) in
>>>> on line 164
>>>> Result: Image display fails.
>>>> IMO there should be a check/limitation not to pass large images to GD.
>>>> Do any others have such issues?
>>> Yes. Maybe we could calculate somehow memory requirement of the image
>>> and skip conversion or add a configuration option specifying max image
>>> size. In both cases if we skip image conversion we should probably
>>> display some nice fallback thumbnail image.
>>> ps. You can configure Roundcube to use ImageMagick instead of GD
>> the problem is *not* large images, the problem is that some even small
>> images compressed with insane algorithms needs a lot of temporary RAM
>> there is no way to catch that on the PHP side except raise the limits
> May be a workaround is to call resized images by an AJAX request and if the
> request errors out to use a fallback without passing things to GD
> Another question is what to do with logging. I would prefer to supress the error log
no way - the fatal error reporting of PHP is far out of the application scope
execpt you disable any error logging global which would not be very smart
roundcube is running fine with error_reporting E_ALL and no memory limits
there is a reason why i decided by over years increasing limits to configure
memory_limit = "-1" because in case of CMS systems which *must* scale down
images before store them on the server it's unacceptable crashing the app
while the site-owner himself wants to upload a image which looks fine on
his desktop nor is it's sie above the upload limits controlled by the CMS
the memory_limit is for servers with the need of running untrusted code
set it to 512 MB and you are fine if you have modern hardware where
from time to time a GB temporary RAM don't matter
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 246 bytes
Desc: OpenPGP digital signature
More information about the dev