Page 1 of 1

Using Imagick -draw image over with php exec returns 126 out

Posted: 2014-07-29T06:02:58-07:00
by urewelcome
I'm trying to draw an image onto a blank canvas using php exec

Code: Select all

exec("convert -size ".$final_image_w."x".$final_image_h." xc:white 
		-draw 'image over 0,1659 500,200 /home/isocia5/public_html/fbcalendar/images/exports/cal_print_bot_1.jpg' 
		/home/isocia5/public_html/fbcalendar/src/php/upload/temp/blank_image_".$canvas_id.".jpg",$out,$err);
but i get a 126 error out.

I'm guessing it have something to do with the image path...
Should i use more quotes somewhere? or escape some?

Re: Using Imagick -draw image over with php exec returns 126

Posted: 2014-07-29T07:47:49-07:00
by Bonzo
You are using Imagemagick with the command line not Imagick.

Your code seems a bit over complicated as you do not need all the " and .

Try writing it like this as you can echo the command and see it contains what you expect, I also create my names outside of the exec() as I think it is easier:

Code: Select all

// Untested
// Paths can be relative which will clean up these imagempaths
$input = '/home/isocia5/public_html/fbcalendar/images/exports/cal_print_bot_1.jpg';
$output = "/home/isocia5/public_html/fbcalendar/src/php/upload/temp/blank_image_'.$canvas_id.'.jpg";
// I assume you a placing one image onto a plain background - if it is I would use -extent as it is a lot simpler
$cmd =" -size {$final_image_w}x{$final_image_h} xc:white $input  -geometry +1659+500 -composite ";
echo $cmd.'<br>';    
exec("convert $cmd $output ",$out,$err);

Re: Using Imagick -draw image over with php exec returns 126

Posted: 2014-07-29T08:04:35-07:00
by urewelcome
Bonzo, ThankX
That does it.

I'm new to Imagick, and appreciate your help very much :)