 |
|
เจอปัญหาว่า
upload ภาพขึ้น server แล้ว resize ปรากฎว่าสีขอยภาพเพี้ยนไป
จะแก้ไขยังไงดีค่ะ
copy($HTTP_POST_FILES["pic".$i]['tmp_name'],$tpath.$name); // original temp
list($w1, $h1) = getimagesize("pic/original/$name"); // Get new dimensions
if($w1>500){
$quality =100;
$w2 = 500 ; #
$percent = $w2 / $w1 ;
$h2 = $h1 * $percent ;
//$im = imageCreateTrueColor($w2, $h2);
if($lnamepic=="gif"){
$im1 = imagecreatefromgif("pic/original/$name");
}else if(($lnamepic=="jpg")||($lnamepic=="jpeg")) {
$im1 = imagecreatefromjpeg("pic/original/$name");
}
$im=imagecreate($w2,$h2);
imagecopyresampled($im, $im1, 0, 0, 0, 0, $w2, $h2, $w1, $h1);
#imagecopyresized($im, $im1, 0, 0, 0, 0, $w2, $h2, $w1, $h1);
#imageString($im, 5, 5, $h2 - 20, "website.com", $light);
$thumbfile="pic/gallery/";
if($lnamepic=="gif"){
imagegif($im,"pic/gallery/$name",$quality);
}else if(($lnamepic=="jpg")||($lnamepic=="jpeg")) {
imagejpeg($im,"pic/gallery/$name",$quality);
}
imagedestroy($im);
imagedestroy($im1);
}else{
copy($HTTP_POST_FILES["pic".$i]['tmp_name'],"pic/gallery/".$name); // gallery path
}
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-01-09 11:37:31 |
By :
ioff |
View :
1458 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |