Hi All,
I am trying to resize the image and trying to set frame onto 4 side of the image,
My code is given here, I dont know how to do that,
If any one have idea, Please help me to solve this example
I have added the images of various sizes, 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg
Need to set the frame on that.
https://www.dropbox.com/s/6exr8tvgja1c8 ... border.zip
Thanks in advance....
Set Frame on Image by Append and Merge
Re: Set Frame on Image by Append and Merge
Here is My latest code, Just need to put the left and right edges on the back side only, but still resizing is not working with, for image 2.jpg
<?php
// Input image
$image = '3.jpg';
// Resize to a png to stop quality loss
exec("convert $image -thumbnail 500x500 temp.png");
$size = getimagesize('temp.png');
//echo "<pre>";print_r($size);echo "</pre>";
$w = $size[0];
$h = $size[1];
if($w > $h){
$c_w = 635;
$c_h = 590;
}elseif($w == $h){
$c_w = 635;
$c_h = 590;
}else{
// $c_w = (500 * 90) / $w;
$c_w = $w + 90;
$c_h = 500;
}
exec("convert brown_golden_top.jpg -thumbnail {$c_w}x{$c_h} brown_golden_top.png");
exec("convert brown_golden_top.png -flip brown_golden_bottom.png");
exec("convert brown_golden_top.png -rotate 270 brown_golden_left.png");
exec("convert brown_golden_left.png -flop brown_golden_right.png");
$cmd = 'brown_golden_top.png -background none temp.png -background white -gravity center -append append_center.png';// Display the final image
exec("convert $cmd");
$cmd = "composite -gravity east brown_golden_right.png append_center.png append_center_1.png";
exec("$cmd");
$cmd = "composite -gravity south brown_golden_bottom.png append_center_1.png append_center_2.png";
exec("$cmd");
$cmd = "composite -gravity west brown_golden_left.png append_center_2.png append_center_3.jpg";
exec("$cmd");
echo "<img src=\"append_center_3.jpg\">";
?>
<?php
// Input image
$image = '3.jpg';
// Resize to a png to stop quality loss
exec("convert $image -thumbnail 500x500 temp.png");
$size = getimagesize('temp.png');
//echo "<pre>";print_r($size);echo "</pre>";
$w = $size[0];
$h = $size[1];
if($w > $h){
$c_w = 635;
$c_h = 590;
}elseif($w == $h){
$c_w = 635;
$c_h = 590;
}else{
// $c_w = (500 * 90) / $w;
$c_w = $w + 90;
$c_h = 500;
}
exec("convert brown_golden_top.jpg -thumbnail {$c_w}x{$c_h} brown_golden_top.png");
exec("convert brown_golden_top.png -flip brown_golden_bottom.png");
exec("convert brown_golden_top.png -rotate 270 brown_golden_left.png");
exec("convert brown_golden_left.png -flop brown_golden_right.png");
$cmd = 'brown_golden_top.png -background none temp.png -background white -gravity center -append append_center.png';// Display the final image
exec("convert $cmd");
$cmd = "composite -gravity east brown_golden_right.png append_center.png append_center_1.png";
exec("$cmd");
$cmd = "composite -gravity south brown_golden_bottom.png append_center_1.png append_center_2.png";
exec("$cmd");
$cmd = "composite -gravity west brown_golden_left.png append_center_2.png append_center_3.jpg";
exec("$cmd");
echo "<img src=\"append_center_3.jpg\">";
?>
Re: Set Frame on Image by Append and Merge
Have you see this post on Anthony's website: http://www.imagemagick.org/Usage/thumbnails/#frame_edge
Try this:
Try this:
Code: Select all
<?php
$cmd =" 1.jpg -write mpr:image +delete ".
" brown_golden_top.jpg -write mpr:edge_top +delete ".
" brown_golden_bottom.jpg -rotate 180 -write mpr:edge_btm +delete ".
" mpr:image -alpha set -bordercolor none ".
" -compose Dst -frame 53x53+53 -compose over ".
" -transverse -tile mpr:edge_btm ".
" -draw \"color 1,0 floodfill\" -transpose -draw \"color 1,0 floodfill\" ".
" -transverse -tile mpr:edge_top ".
" -draw \"color 1,0 floodfill\" -transpose -draw \"color 1,0 floodfill\" ".
" mpr:image -gravity center -composite ";
exec("convert $cmd frame_gold.png");
?>
<img src="frame_gold.png">
Re: Set Frame on Image by Append and Merge
Hey Bonzo,
You got thousands salute.......
You gave a single line answer, but you know , I an confused with this logic, as i am a new born fish in this ocean.
What all this syntax means, I am trying to learning meanwhile.
Thank a Lot again, You helped me.
One personal question on the closing of this issue,
What are you guy have in food everyday, man???...... I would like to have all those food, so i can learn quickly.....
Cheers.....
You got thousands salute.......
You gave a single line answer, but you know , I an confused with this logic, as i am a new born fish in this ocean.
What all this syntax means, I am trying to learning meanwhile.
Thank a Lot again, You helped me.
One personal question on the closing of this issue,
What are you guy have in food everyday, man???...... I would like to have all those food, so i can learn quickly.....
Cheers.....
Re: Set Frame on Image by Append and Merge
I can not take credit as I only slightly modified Anthony's example.
Re: Set Frame on Image by Append and Merge
Yeah, I would Say, Antony Sir....