Thumbnailing with php code?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
acctman

Thumbnailing with php code?

Post by acctman »

I what to thumbnail images to a max width 190px and max height of 125px keeping within aspect ratio
ex: Large.jpg thumbnailed to 190 x 125 tn_small.jpg

does anyone know how to do this in php, fast clean with min. cpu usage
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Thumbnailing with php code?

Post by mkoppanen »

acctman wrote:I what to thumbnail images to a max width 190px and max height of 125px keeping within aspect ratio
ex: Large.jpg thumbnailed to 190 x 125 tn_small.jpg

does anyone know how to do this in php, fast clean with min. cpu usage
Try this:

Code: Select all

<?php
$im = new Imagick("Large.jpg");
$im->thumbnailImage(190, 125, true);
$im->writeImage("tn_small.jpg");
?>
Mikko Koppanen
My blog: http://valokuva.org
acctman

Re: Thumbnailing with php code?

Post by acctman »

mkoppanen wrote:
acctman wrote:I what to thumbnail images to a max width 190px and max height of 125px keeping within aspect ratio
ex: Large.jpg thumbnailed to 190 x 125 tn_small.jpg

does anyone know how to do this in php, fast clean with min. cpu usage
Try this:

Code: Select all

<?php
$im = new Imagick("Large.jpg");
$im->thumbnailImage(190, 125, true);
$im->writeImage("tn_small.jpg");
?>
this is great thanks, is the a listing of all the functions somewhere? Because, i'd like to add -strip and -unsharp
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Thumbnailing with php code?

Post by mkoppanen »

Mikko Koppanen
My blog: http://valokuva.org
Post Reply