/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
); 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); } }