Re: Upload form with IMagick
Posted: 2012-10-17T09:31:20-07:00
NOTE:- depending on your specified sizes for the original thumbnail etc. this will all need to change so everything fits. But see if you get a result from this:
Code: Select all
$new_image = $arr['img_src'];
####CROP | RESIZE THE THUMBNAIL TO 450x450 | ADD BORDER 50x50####
$save_to = $uploaddir.$thumbnail;
exec("/usr/bin/ImageMagick_6.2.6/bin/convert $new_image -crop {$height}x{$width}+$x+$y -resize 450x450 -bordercolor black -border 50x50 $save_to");
echo "<img src=\"$save_to\">";
####ADD FULLSIZED WATERMARK-IMAGE####
// The watermak to add - probably with a transparent background
$input1 = 'watermark.png';
// Resize the watermark
exec("/usr/bin/ImageMagick_6.2.6/bin/convert $input1 -resize 450x450 temp.png");
// Not sure if you can save over the original but that can be tested later
$watermarked = $uploaddir."watermarked.jpg";
exec("/usr/bin/ImageMagick_6.2.6/bin/composite -watermark 80% -gravity center $temp $save_to $watermarked");
echo "<img src=\"$watermarked\">";