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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jwwceo
Posts: 2
Joined: 2016-10-27T11:36:23-07:00
Authentication code: 1151

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
jwwceo
Posts: 2
Joined: 2016-10-27T11:36:23-07:00
Authentication code: 1151

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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).
Post Reply