Imagemagick script

software development

#1

Hi, ive been driving myself crazy trying to get this imagemagick thumbnail script to work for almost 2 hrs. Everything seems to be in the right location with no errors but the script just runs through without converting, then deletes the old file (as it should). Im stuck.

$location=’/usr/bin/convert’;

$make_magick_th = system("$location -resize x60 -gravity North -crop 60x60+0+0 -quality 75 -strip $current_file $thumb_name", $retval_th);


#2

here’s a sample convert script for php, maybe it’ll help get you in the right direction.
Silk

<?php $location='/usr/bin/convert'; $command='-thumbnail 150'; $name='glass.'; $extfrm='jpg'; $extto='png'; $output="{$name}{$extto}"; $convert=$location . ' ' .$command . ' ' . $name . $extfrm . ' ' . $name . $extto; exec ($convert); print ""; ?>

My website


#3

Thanks for the script, i think i saw it already in the dreamhost wiki

http://wiki.dreamhost.com/index.php/Image_Magick

It seems to put together the exec() call like my script compiles its system()

The problem is that my script works on two other servers and i dont want to have to completely rewrite it for dreamhost (theres also more of it than ive posted).

Eveything else in the script seems to work, ive checked all the variables. Im just wondering whether i need to do a system() call differently in php-cgi or something. Any ideas?


#4

Ok, ive changed the structure of my script:

$location=’/usr/bin/convert’;
$command = ‘-resize x60 -gravity North -crop 60x60 0 0 -quality 75 -strip’;

$convert = $location . ’ ’ .$command . ’ ’ . $current_file . ’ ’ . $thumb_name;

exec($convert);

echo("");
$myFile = $current_file;
unlink($myFile);

But i still get nothing :frowning:


#5

If I am reading it right, it looks like the problem is in the echo statement. It looks like single quotes are surrounding the string. Remove the quotes or use double quotes.
Silk

My website


#6

If in doubt, go to ssh and try your imagemagick command there to see the response direct from the binary without php confusing the issue further. Have you checked the paths are correct for your input and output? Have you checked your error logs for output written there?

East Coast Interactive


#7

I managed to solve that problem, it was my upload path. In my new dreamhost account the server path has a .com in it. I was splitting up the path by the . to find the extension so it all went wrong:)