You are here: Re: img border? « PHP Language « IT news, forums, messages
Re: img border?

Posted by Connector5 on 10/22/48 11:35

Sorry :-) The holidays and family et al.

I'll fiddle with your code and a sample image tonight and get back with you
:-)


"roN" <NOspam@example.com> wrote in message
news:414c05F1dd92uU1@individual.net...
> roN wrote:
>
> > Connector5 wrote:
> >
> >> 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
> >
> > hm, okay, I tried this but didnt't work, why not?
> > // 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+40,$newheight+40);
> > // [added stuff]
> > $color_body=imagecolorallocate($newpic,222,222,222);
> > $color_rect= imagecolorallocate($image,99,99,99);
> > imagerectangle($newpic,0,0,$newwidth+40,$newheight+40,$color_rect);
> > // [/added stuff]
> > // changed pos of resizedpic in the new img.
> > ImageCopyResized($newpic,$oldpic,(($newwidth+40)/2-($newwidth/2))
> > (($newheight+40)/2-($newheight/2)),0,0,$newwidth,$newheight,$breite
> $hohe);
> >
> > Imagejpeg($newpic);
> >
> > Thank you!
> >>
> >>
> >> "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'
> >
>
> no suggestion to solve this issue...? :(
>
> --
> chEErs roN
>
> I'm root, I'm allowed to do this! ;)
> keep on rockin'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация