Skip to content

Instantly share code, notes, and snippets.

@apatton-cnet
Created June 21, 2013 15:34
Show Gist options
  • Save apatton-cnet/5832046 to your computer and use it in GitHub Desktop.
Save apatton-cnet/5832046 to your computer and use it in GitHub Desktop.
image thumbnailer
function create_image_thumbnails($image_filename) {
$image = new Imagick("images/original/" . $image_filename);
$image->scaleImage(800,0);
$image_details = $image->getImageGeometry();
if ($image_details['height'] > 600) {
$image->scaleImage(0,600);
}
$image->writeImage("images/normal/" . $image_filename);
$image->scaleImage(400,0);
$image->writeImage("images/medium/" . $image_filename);
$image->scaleImage(200,0);
$image->writeImage("images/small/" . $image_filename);
$image->destroy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment