I had followed that : http://alvarotrigo.com/blog/allocate-memory-on-the-fly-with-php-for-image-resizing/, it's the same that here : http://www.dotsamazing.com/en/labs/phpmemorylimit

An other way is to use imagemagick