Imagemagick script

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.


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

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

<?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

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

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?

Ok, ive changed the structure of my script:

$command = ‘-resize x60 -gravity North -crop 60x60 0 0 -quality 75 -strip’;

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


$myFile = $current_file;

But i still get nothing :frowning:

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.

My website

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

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:)