Image Resizing and Compression

Posted by GSTAR on Stack Overflow See other posts from Stack Overflow or by GSTAR
Published on 2010-12-24T00:00:35Z Indexed on 2010/12/24 0:54 UTC
Read the original article Hit count: 204

Filed under:
|

Hi guys,

I'm implementing an image upload facility for my website. The uploading facility is complete but what I'm working on at the moment is manipulating the images. For this task I am using PHPThumb (http://phpthumb.gxdlabs.com).

Anyway as I go along I'm coming across potential issues, to do with resizing and compression. Basically I want to acheive the following results:

  1. The ideal image dimensions are: 800px width, 600px height. If an uploaded image exceeds either of these dimensions, it will need be resized to meet the requirements. Otherwise, leave as it is.

  2. The ideal file size is 200kb. If an uploaded image exceeds this then it will need to be compressed to meet this requirement. Otherwise, leave as it is.

So in a nutshell: 1) Check the dimensions, resize if required. 2) Check the filesize, compress if required.

Has anybody done anything like this / could you give me some pointers? Is PHPThumb the correct tool to do this in?

© Stack Overflow or respective owner

Related posts about php

Related posts about image