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?".
avvllvva
Post
by avvllvva » 2010-01-20T06:51:48-07:00
Hi,
Can anybody tell what is wrong with following php code for resizing image with space fill?
Code: Select all
<?php
exec($path_to_convert." ".$imagePath." -resize 80x80 -size 80x80 xc:blue +swap -gravity center -composite ".$newPath);
?>
This is working perfectly in local machine but not in server.
Note:- My server have Imagick S/W and its working perfectly with another methods like simple resizing, aspect ratio etc.
I tried examples from
http://www.imagemagick.org/Usage/resize/#space_fill
Thanks
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2010-01-20T06:56:32-07:00
See if you get an error running like this :
Code: Select all
<?php
$array=array();
echo "<pre>";
exec($path_to_convert." ".$imagePath." -resize 80x80 -size 80x80 xc:blue +swap -gravity center -composite ".$newPath 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2010-01-20T10:54:47-07:00
you could also try
convert image -resize 80x80 -gravity center -background blue -extent 80x80 result
or
convert monet3.jpg -resize "80x80^" -gravity center -crop 80x80+0+0 +repage result
if on windows see notes about ^ at
http://www.imagemagick.org/Usage/windows/
avvllvva
Post
by avvllvva » 2010-01-21T03:56:33-07:00
Hi Bonzo, this is the output
Array
(
[0] => convert: Unrecognized option (+swap).
)
1
------------------------------------------
also no luck with fmw42 soln
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2010-01-21T08:34:37-07:00
What version is on the server compaired to your local machine ?