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

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
urewelcome
Posts: 4
Joined: 2014-07-29T05:50:05-07:00
Authentication code: 6789

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

Post 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?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post 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);
urewelcome
Posts: 4
Joined: 2014-07-29T05:50:05-07:00
Authentication code: 6789

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

Post by urewelcome »

Bonzo, ThankX
That does it.

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