Güvenlik konusu önemlidir. Ve bir kez daha anladım ki sahiden göreceliymiş bu kavram
Siz nasıl biliyorsanız öyle yapın. Ben bildiğimi ve okuduklarımı yorumladım burada
Darılmayın

amacımız belli
Bu yöntemime bir yorum yapabilirmisin
<?php
header ("Content-type: klasör/jpeg");
if( isset($_GET['File']))
$img = $_GET['File'];
if( isset($_GET['percent'])){
$percent = $_GET['percent'];
}else{
$percent=0;
}
if( isset($_GET['constrain']))
$constrain = $_GET['constrain'];
if( isset($_GET['w']))
$w = $_GET['w'];
if( isset($_GET['h']))
$h = $_GET['h'];
$x = @getimagesize($img);
$sw = $x[0];
$sh = $x[1];
if ($percent > 0) {
// YÜZDELİK ORANTI HESAPLA
$percent = $percent * 0.01;
$w = $sw * $percent;
$h = $sh * $percent;
} else {
if (isset ($w) AND !isset ($h)) {
// sadece genişlik ayarlanmışsa yüksekliği uyarla
$h = (100 / ($sw / $w)) * .01;
$h = @round ($sh * $h);
} elseif (isset ($h) AND !isset ($w)) {
// sadece yükseklik ayarlı ise genişliği uyarla
$w = (100 / ($sh / $h)) * .01;
$w = @round ($sw * $w);
} elseif (isset ($h) AND isset ($w) AND isset ($constrain)) {
//küçük çıkan görüntü boyutu olsun eğer her iki yükseklik ve genişliği ayarlanır ve $ kısıtlayan de ayarlanır
$hx = (100 / ($sw / $w)) * .01;
$hx = @round ($sh * $hx);
$wx = (100 / ($sh / $h)) * .01;
$wx = @round ($sw * $wx);
if ($hx < $h) {
$h = (100 / ($sw / $w)) * .01;
$h = @round ($sh * $h);
} else {
$w = (100 / ($sh / $h)) * .01;
$w = @round ($sw * $w);
}
}
}
$im = @ImageCreateFromJPEG ($img) or
$im = @ImageCreateFromPNG ($img) or
$im = @ImageCreateFromGIF ($img) or
$im = false;
if (!$im) {
// PHP'nin ImageCreate işlevleri bozuk olsun
// Öyleyse asıl görüntü içeriğini geri yansıtsın
readfile ($img);
} else {
// Görüntü oluştur
$thumb = @ImageCreateTrueColor ($w, $h);
// kaynaktan Kopya görüntü
@ImageCopyResampled ($thumb, $im, 0, 0, 0, 0, $w, $h, $sw, $sh);
// Görüntü çıkışı
$colorCross = imagecolorallocate($thumb, 210, 220,60);
//imageString($thumb, 3, 5, $h-15, "",$colorCross);
@ImageJPEG ($thumb);
}
?>