| Jean Pierre Daviau 2006-03-30, 7:57 am |
| Hi to every one and yes, me again,
I done a working script, would you believe?
http://jeanpierredaviau.com/news/titimg.php
But although the original image has lot of red, the resampled image is
green only.
-----------------
$inImg = "a.jpg";
$max_width = 200;
$max_height = 150;
$size = GetImageSize($inImg);
$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($inImg);
$dst = ImageCreate($tn_width, $tn_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width,
$height);
ImageFilter($dst, IMG_FILTER_CONTRAST, -10);
//header("Content-type: image/jpg");
ImageJpeg($dst, "mini.jpg", 75);
ImageDestroy($src);
ImageDestroy($dst);
----------------------------
Thanks for your attention.
Jean Pierre Daviau
--
Easyphp1.8
Apache1.3.24
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
http://www.jeanpierredaviau.com
|