John
John

Reputation: 163

Create thumbnail in php

I am trying to find a script which can create thubnail by cropping and transforming. For example: the original image size is 800x750. But I want to create a thumbnail of size 150x110. So it should first transform the image to that size and then crop the area which falls out. Hope I made myself clear. Thanks in advance.

Upvotes: 1

Views: 165

Answers (2)

Iłya Bursov
Iłya Bursov

Reputation: 24146

there is two main methods to create proportional thumbnail:

  1. "touch from inside" - for this method you will need to downscale your image to NOT exceed your size (150, 100), so you will get image which size for one side is the same and the other side is less or equal (examples: 140x100, 150x90), then you will need to fill space around this image to fit exactly 150x100
  2. "touch outside" - for this method you will need to downscale your image that one side is the same, another side is greater or equal (examples: 160x100, 150x110), in this case you then need to crop to fit

select any method you want, math for both methods are elementary

Upvotes: 0

Vinod VT
Vinod VT

Reputation: 7149

You can use the timthumb plugin.

http://code.google.com/p/timthumb/

Upvotes: 2

Related Questions