Page 1 of 1

Getting errors on live server, not on dev using -Flatten and -Alpha

Posted: 2016-10-27T11:42:08-07:00
by jwwceo
Hello,

I am trying to use the following command for making a simple thumbnail for uploads. Needs to work on PDF, JPG, GIF, and PNG...the output format is always a JPG. I'm using PHP. This code works perfect on my laptop environment but fails on live server.

The error I'm getting is: cannot create -flatten: Permission denied.

exec("/usr/bin/convert \"{$filepath}[0]\" -background white -resize {$resize} -flatten -alpha remove $thumbTemp 2>&1",$out,$return);

Any ideas??

James

Re: Getting errors on live server, not on dev using -Flatten and -Alpha

Posted: 2016-10-27T11:57:02-07:00
by fmw42
What are your IM versions and platforms?

Is it possible that your $resize is empty? Check your variable values.

I do not use PHP that much. Are your arguments from PHP or unix variables. why the braces { ... }?

Please always provide your IM version and platform when asking questions in the future.

Re: Getting errors on live server, not on dev using -Flatten and -Alpha

Posted: 2016-10-27T12:20:46-07:00
by jwwceo
SOLVED: I have two different Image magick versions on dev(7.0.1)and live. The live version is older(6.7), and does not like the carat in my $resize variable.
When I remove the carat it works. My resize variable was as follows:

$resize = '120x160>';

I will just update version on live to match. Should work.

Re: Getting errors on live server, not on dev using -Flatten and -Alpha

Posted: 2016-10-27T13:21:25-07:00
by fmw42
The ^ symbol has been around for a while. It should have worked. How was it expressed? Perhaps a bug in your 6.7 version.

From the changelog:

2008-01-24 6.3.8-2 Cristy <quetzlzacatenango@image...>
Support a ^ meta character in an image geometry (.e.g convert 640x480.png -resize 240^ returns a 320x240 result).