|
Posted by Connector5 on 12/21/05 17:56
imagerectangle will work fine if you use it right. Paint the image black,
use imagerectangle to draw the grey borders, then import the existing jpeg
into the center of the image.
Centering 101:
InnerTop = (OuterHeight / 2) - (InnerHeight / 2)
InnerLeft = (OuterWidth / 2) - (InnerWidth / 2)
voila
"roN" <NOspam@example.com> wrote in message
news:40s1htF1bma84U1@individual.net...
> Hey guys,
>
> I resize images with following code and it seems to work good
> [code]
> <?php
> header("Content-type: image/jpeg");
> header("Content-Disposition: inline; filename=\"". $src . "");
>
> if (isset($x))
> $detail_max_x=$x;
> else
> $detail_max_x = 300;
>
> if (isset($y))
> $detail_max_y=$y;
> else
> $detail_max_y = 300;
>
> $type = "jpg";
>
> // orginalpic
> $pic=$src;
>
> // get pic data
> $size=getimagesize($pic);
> $factor_y=$size[0]/$detail_max_y;
> $factor_x=$size[1]/$detail_max_x;
>
> $breite = $size[0];
> $hohe = $size[1];
>
> // factor to shrink/enlarge
> if($factor_y < $factor_x)
> { $sfactor = $factor_x; }
> else
> { $sfactor = $factor_y; }
>
> $newwidth=intval($size[0]/$sfactor);
> $newheight=intval($size[1]/$sfactor);
>
>
> //JPG output
> $oldpic=ImageCreateFromJPEG($pic);
> $newpic=imagecreatetruecolor($newwidth,$newheight);
> ImageCopyResized($newpic,$oldpic,0,0,0,0,$newwidth,$newheight,$breite
> $hohe);
> Imagejpeg($newpic);
> ?>
> [/code]
> but what I would like to do now is:
> I wanna draw arround everypicture a border with black rectangles, let's
say
> about 20pixels width. and in the at the outer border of the picture, (now
> it's 2'px bigger) I wanna draw a 1px grey line with color #999999.
> understand what i wanna do?
> like:
> ooooooooooo
> o picture o
> ooooooooooo
> and the 'o's are 20px and around this 'o's I wanna ae a grey 1 px
> border... :) possible? I tried some things with imagerectangle()
> but didn't get it to work.
> Thank you guys! :)
>
> --
> chEErs roN
>
> I'm root, I'm allowed to do this! ;)
> keep on rockin'
[Back to original message]
|