merhaba arkadaşlar, elimde bir resim galerisi script'i var. upload ve gösterme işlemleri sorunsuz çalışıyor ancak ben istiyorumki resimleri upload ederken standart 640*480 boyutlarına getirsin.
imageresize yerleri var içinde ama hangilerini değiştirmem gerektiğini tam olarak çözemedim. width, height, modwidth, modheight değerlerini falan değiştirdim ama direk orjinal boyutunu alıp kaydediyor. ben mi beceremedim yoksa başka bir numarası mı vardır bunun? upload eden kod aşağıdaki gibi;
$imagename = $_FILES['new_image']['name'];
$source = $_FILES['new_image']['tmp_name'];
$target = "../js_slideshow/photos/01/".$imagename;
move_uploaded_file($source, $target);
$imagepath = $imagename;
$save = "../js_slideshow/photos/kucuk/" . $imagepath; //kaydedilen dosya
$file = "../js_slideshow/photos/01/" . $imagepath; //orjinal dosya
if(!empty($imagepath))
{
list($width, $height) = getimagesize($file) ;
$modwidth = 150;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
$save = "../js_slideshow/photos/kucuk/" . $imagepath; //kaydedilen dosya
$file = "../js_slideshow/photos/01/" . $imagepath; //orjinal dosya
list($width, $height) = getimagesize($file) ;
$modwidth = 80;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;konu
htmlkodlar'ına aittir.