Page 2 of 2

Re: Cropping larger images breaks imagick.

Posted: 2014-02-20T15:18:13-07:00
by Bonzo
Yes I think that is the standard version for Linux.

Code: Select all

$input = $_SERVER['DOCUMENT_ROOT']."/orginal_53064950710a4.jpg";
exec("convert $input -crop 5000,3000+0+0 output.jpg");
That version should work OK for what you want to do.

Re: Cropping larger images breaks imagick.

Posted: 2014-02-20T15:20:35-07:00
by Bonzo
So how do I update? :/
That is one of the cockups I was talking about earlier; I managed to corrupt the Imagemagick install totally. I have done it on other servers without a problem but something just went wrong last time :?

Re: Cropping larger images breaks imagick.

Posted: 2014-02-20T15:30:45-07:00
by fmw42
What version of Imagick are you using? check your phpinfo.php Perhaps you are using a too old version of Imagick also. see http://pecl.php.net/package/imagick

Is this your own personal server/computer or on a shared host? If the latter, you may have a hard time getting them to upgrade anything.

Re: Cropping larger images breaks imagick.

Posted: 2014-02-21T03:15:53-07:00
by eleison
fmw42 wrote:What version of Imagick are you using? check your phpinfo.php Perhaps you are using a too old version of Imagick also. see http://pecl.php.net/package/imagick

Is this your own personal server/computer or on a shared host? If the latter, you may have a hard time getting them to upgrade anything.
Its a VPS, my friend is owning the server, I will move to a newer and better server in the future. My imagick version is: 3.1.2. How much memory should an imagemagick crop function eat?? If I got memory issues only by testing the function my self, wouldn't there be even more problems when multiple users using the function in a live environment?

Thanks for all help!

Re: Cropping larger images breaks imagick.

Posted: 2014-02-21T04:19:08-07:00
by eleison
I finally got it to display:
Fatal error: Uncaught exception 'ImagickException' with message 'Insufficient memory (case 4) `

:O

Re: Cropping larger images breaks imagick.

Posted: 2014-02-21T04:42:00-07:00
by eleison
Ok, it's working now :)

Solution:
// pixel cache max size
IMagick::setResourceLimit(imagick::RESOURCETYPE_MEMORY, 64);
// maximum amount of memory map to allocate for the pixel cache
IMagick::setResourceLimit(imagick::RESOURCETYPE_MAP, 64);


Found answer here:
http://sourceforge.net/apps/trac/gallery/ticket/1513

And here:
http://stackoverflow.com/questions/4367 ... rge-images

Btw: How i debuged was:
1. Edit in php.ini:
log_errors = Off -> log_errors = On

2. Put this in start of your php code:
error_reporting(E_ALL);

Thanks everyone for taking your time :)

Re: Cropping larger images breaks imagick.

Posted: 2014-02-21T08:37:34-07:00
by Bonzo
Thanks for the update eleison and I am glad it is now sorted.