imagecopyresampled green color only

This is a discussion on imagecopyresampled green color only within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi to every one and yes, me again, I done a working script, would you believe? http://jeanpierredaviau.com/news/...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-30-2006
Jean Pierre Daviau
 
Posts: n/a
Default imagecopyresampled green color only

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


Reply With Quote
  #2 (permalink)  
Old 03-30-2006
Jean Pierre Daviau
 
Posts: n/a
Default Re: imagecopyresampled green color only

solved with this line:
$thumb = @imagecreatetruecolor ($tn_width, $tn_height) or die ("flux d'image
GD impossible");


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:39 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0