if($FotografKayitDurum){
$targ_w = $targ_h = 350;
$post_x = intval(htmlspecialchars($_POST['x']));
$post_y = intval(htmlspecialchars($_POST['y']));
$jpeg_quality = 100;
$src = "../Images/" . $YeniFotografAdi;
if($uzanti == "jpeg" || $uzanti == "jpg"){
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$post_x,$post_y,
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/jpeg');
imagejpeg($dst_r,"../Images/" . $YeniFotografAdi,$jpeg_quality);
}elseif($uzanti == "gif"){
$img_r = imagecreatefromgif($img_r);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagealphablending($dst_r, false);
$colorTransparent = imagecolorallocatealpha($dst_r, 0, 0, 0, 0x7fff0000);
imagefill($dst_r, 0, 0, $colorTransparent);
imagesavealpha($dst_r, true);
imagecopyresampled($dst_r,$img_r,0,0,$post_x,$post_y,
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/gif');
imagegif($dst_r,"../Images/" . $YeniFotografAdi,$jpeg_quality);
}elseif($uzanti == "png"){
$img_r = imagecreatefrompng($img_r);
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagealphablending($dst_r, false);
$colorTransparent = imagecolorallocatealpha($dst_r, 0, 0, 0, 0x7fff0000);
imagefill($dst_r, 0, 0, $colorTransparent);
imagesavealpha($dst_r, true);
imagecopyresampled($dst_r,$img_r,0,0,$post_x,$post_y,
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/png');
imagepng($dst_r,"../Images/" . $YeniFotografAdi,$jpeg_quality);
}
imagedestroy($dst_r);
}
Sorunu bazı dosyalar çıkartıyor. Normal upload yapınca sorunsuz yükleniyor ama kırpma işlemi için yukarıdaki yapıyı kullanırken bazı png uzantılı dosyalar beyaz oluyor.