Revision: 27729
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2010 05:43 by metoikos
Initial Code
$file_sizes = array( array(100, 75), array(160, 120), array(300, 200), array(200, 150), array(620, 400), array(1024, 768) ); if($file->getWidth() / $file->getHeight() >= 1.5) { foreach($file_sizes as $key => $size) { $small_file_path = '/home/rocko/Desktop/kingo-disko/test/photo-test/res1_st'.$key.'.jpg'; $line = $file->getHeight() * $size[0] / $size[1]; $file->crop('center', 'center', $line, $file->getHeight())->resize($size[0], $size[1])->saveToFile($small_file_path); } } else { foreach($file_sizes as $key => $size) { $small_file_path = '/home/rocko/Desktop/kingo-disko/test/photo-test/res1_st'.$key.'.jpg'; $line = $file->getWidth() * $size[1] / $size[0]; $file->crop('center', 'center', $file->getWidth(), $line)->resize($size[0], $size[1])->saveToFile($small_file_path); } }
Initial URL
Initial Description
Initial Title
aspect ratio friendly image resize
Initial Tags
php, resize, image
Initial Language
PHP