Mam taki kod:
function resize_ratio($file, $new_w, $new_h, $save) { { return FALSE; } switch ($info['mime']) { case "image/gif": $file = imagecreatefromgif($file); break; case "image/jpeg": $file = imagecreatefromjpeg($file); break; case "image/png": $file = imagecreatefrompng($file); break; } $old_x = imageSX($file); $old_y = imageSY($file); $wysokosc = imagesy($file); $szerokos = imagesx($file); $wpol = $szerokos/$new_w; $nowysokosc = $wysokosc * $wpol; if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $th = ImageCreateTrueColor($thumb_w, $thumb_h); @imagecopyresampled($th, $file, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y); @imagejpeg($th, $save); @imagedestroy($file); @imagedestroy($th); return TRUE; } resize_ratio($zdjecie, 660, $nowysokosc, $zdjecie);
Ale on nie zmniejsza obrazka ,a ja chcę żeby zmiejszał.
Gdy zrobię tak:
resize_ratio($zdjecie, 660, 850, $zdjecie);
To działa ale ja chcę zmniejszać proporcjonalnie.
Jak to zrobić
