Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Image resampling for servers with low memory_limit [ss 2.3]

Go to End

2 Posts   1820 Views


Community Member, 13 Posts

13 September 2010 at 12:44am

Hi guys,
I recently ran into a problem with uncle cheeses image gallery. I want to migrate the website of my hockey club to silverstripe, but since our hosting provider runs php via fast cgi we can't use more than 32MB of memory (even if you try to set a higher memory limit).
While searching for a work around I noticed, that imagemagick is installed on the server and i'm able to call the command line programms of this library (convert, etc.)
Therefore I have rewritten the GD class to use cli calls instead of built-in gd functions. This is a lot faster and the memory usage of called programms does not count to the limit of PHP.

I'll provide my class to you, but beware: it is not properly tested (just didn't have enough time), it won't check if you are able to use "exec". Also not every feature of the original GD class is implemented (e.g. paddedResize, which will call croppedResize instead).

This is for silverstripe 2.3, I haven't checked if the GD class of 2.4 is compatible.


Community Member, 81 Posts

24 September 2010 at 11:32pm

Hi, here's client size resizing swfupload module it'll be helpful for people who tries to upload photos directly from camera, 'cos when u're trying to upload photo more then 8Mb imagemagic will be pretty slow too.

Thx, gieser with both of that solutions everything works really fast

Attached Files