Reply to Re: gd problem: black line at bottem of image

Your name:

Reply:


Posted by Johannes Wienke on 09/28/71 11:44

Am 03.04.2006 12:43 schrieb nescio:
> i have a function to make a thumbnail.
> the functions makes a copy of the thumbnail, so far so good.
>
> the problem is: all the thumbnails have a thin black line at the smallest
> site of the image
[..]
> ----------------------------- source code ---------------------------
> $image: name of the image that must become a thumbnail;
> $max_width: max width of the thumbnail;
> $max_height: max height of the thumbnail;
> $file_name_dest: name of the thumbnail;
>
>
> function maakPlaatje($image, $max_width, $max_height, $file_name_dest){
>
> $size = GetImageSize($image);
> $width = $size[0];
> $height = $size[1];
>
> $x_ratio = $max_width / $width;
> $y_ratio = $max_height / $height;
>
> if ( ($width <= $max_width) && ($height <= $max_height) ) {
> $tn_width = $width;
> $tn_height = $height;
> }else if (($x_ratio * $height) < $max_height) {
> $tn_height = ceil($x_ratio * $height);
> $tn_width = $max_width;
> }else{
> $tn_width = ceil($y_ratio * $width);
> $tn_height = $max_height;
> }
>
> $src = ImageCreateFromJpeg($image);
> $dst = imagecreatetruecolor($tn_width,$tn_height);
>
> ImageCopyResized($dst, $src, 0, 0, 0, 0,
> $tn_width,$tn_height,$width,$height);

You should use imagecopyresampled with truecolorimages.

> $quality = 100;
> $fh=fopen($file_name_dest,'w');
>
> fclose($fh);
> imagejpeg($dst,$file_name_dest, $quality);
>
> ImageDestroy($src);
> ImageDestroy($dst);
> return true;
> }

[Back to original 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

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