aspect ratio friendly square image resize


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $line = $file->getWidth() > $file->getHeight() ? $file->getHeight() : $file->getWidth();
  2. $file->crop('center', 'center', $line, $line)->resize($size[0], $size[1])->saveToFile($save_paths[$key]);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.