IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
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:
$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\">";
I had assumed you were creating $thumbnail somewhere in you main piece of code.
echo your variables to see what they contain.
One thing I always recomend to people is get your code working with fixed variables, everything in the same folder and then build it into a form or expand on it when it is working.
$new_image = $arr['img_src'];
####CROP | RESIZE THE THUMBNAIL TO 450x450 | ADD BORDER 50x50####
$save_to = $uploaddir.$orginal;
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 $save_to;
The problem is that $arr['img_src'] is the path and the filename (uploads/big/44c8168a8a8cd7117f891dd.jpg).
The thumbnails are now in the folder uploads/thumb/uploads/big/
If i upload a JPG everything works fine but if i upload a GIF or PNG "echo $new_image2" shows never the (always) wanted JPG version. How can i fix that?
P.S.
The script creates a JPG and a GIF or PNG version in the right folder.