|
Posted by roN on 12/21/05 05:47
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'
Navigation:
[Reply to this message]
|