Mam kod, pisałem go już dawno i w sumie nie wiele z niego pamiętam

function resize($filef, $new_width, $new_height, $thumb, $quality) { if ($info === false) return false; $img = null; switch($info[2]){ case IMAGETYPE_JPEG: $img = imagecreatefromjpeg($filef); break; case IMAGETYPE_GIF: $img = imagecreatefromgif($filef); break; case IMAGETYPE_PNG: $img = imagecreatefrompng($filef); break; default: return false; } $th = imagecreatetruecolor($new_width, $new_height); switch($info[2]){ case IMAGETYPE_JPEG: imagecopyresampled($th, $img, 0, 0, 0, 0, $new_width, $new_height, $info[0], $info[1]); imagejpeg($th, $filef, $quality); break; case IMAGETYPE_GIF: imagealphablending($th, true); imagetruecolortopalette($img, true, 256); imagecopyresampled($th, $img, 0, 0, 0, 0, $new_width, $new_height, $info[0], $info[1]); imagegif($th, $filef); break; case IMAGETYPE_PNG: imagealphablending($th, false); imagesavealpha($th, true); imagecopyresampled($th, $img, 0, 0, 0, 0, $new_width, $new_height, $info[0], $info[1]); imagepng($th, $filef); break; } imagedestroy($th); imagedestroy($img); return true; } if ($infoo[0]>1024) { $height = (1024/$infoo[0])*$infoo[1]; resize("../files/gallery/".$id."/".$file, 1024, $height, "../files/gallery/".$id."/".$file, 95); } $thumb_height = (150/$infoo[0])*$infoo[1]; resize("../files/gallery/".$id."/thumb_".$file, 150, $thumb_height, "../files/gallery/".$id."/thumb_".$file, 95);
Aha, nie chciałbym używać gotowych skryptów czy bibliotek bo najpierw chciałbym wszystko zrozumieć a potem dopiero bawić sie w coś bardziej skomplikowanego.