mam taki dylemat chcę przyciąć obrazki jpg z góry i z dołu o daną wartość zawsze tą samą .
szukam najlepiej gotowego skryptu
na forum znalazłem coś takiego
<?php $im_file_name="1.jpg"; function resize($im_file_name){ $im_old = imageCreateFromJpeg($im_file_name); $th_max_width = 120; $th_max_height = 120; if($image_attribs[0]>=$image_attribs[1]){ @$ratio = ($width >= $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1]; } else{ @$ratio = ($width < $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1]; } $th_width = $image_attribs[0] * $ratio; $th_height = $image_attribs[1] * $ratio; $im_new = imagecreatetruecolor($th_width,$th_height); imageCopyResampled($im_new,$im_old,0,0,0,0,$th_width,$th_height, $image_attribs[0], $image_attribs[1]); imageJpeg($im_new, $th_file_name ,80); } ?>
Ale coś mi nie działa nie wiem dlaczego ?