Resim çözünürlük hatası.
Arkadaşlar merhaba.. Yönetim panelinden resmi upload ederken çözünürlüğü bozuyor göze çarpacak şekilde bunun sebebi ne olabilir sizce?
Upload Kodu:
$uploadfile = $uploaddir.$resim;
list($width, $height, $type, $attr) = getimagesize($_FILES['resim']['tmp_name']);
move_uploaded_file($_FILES['resim']['tmp_name'], $uploadfile);
if($width > 500){
$filename = $uploadfile;
$source = imagecreatefromjpeg($filename);
$thumbX = "500";
$imageX = imagesx($source);
$imageY = imagesy($source);
$thumbY = ($thumbX*$imageY)/$imageX;
$dest = imagecreatetruecolor($thumbX, $thumbY);
imagecopyresampled ($dest, $source, 0, 0, 0, 0, $thumbX, $thumbY, $imageX, $imageY);
imagejpeg($dest, "../images_up/".$resim);
}
}
Php
şu satır resim kalitesini ayarlar:
imagejpeg($dest, "../images_up/".$resim);
şöyle ekleme yap:
imagejpeg($dest, "../images_up/".$resim, 95);
Php
fotografın bozulmasının sebeb orantısız boyutlandırıyor olman herhangi bir resim dosyasını upload ederken belli sınırlar icerisinde tuttugun icin o sınırlara gore oranlıtı olarak resimi boyutlandırman gerekir bunu el ile photoshop tarzi bir programla yapabilecegin gibi kodlama ile yapabilirsin