A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 4: Plug-in 12 - Resize Image

Although you can easily resize an image using HTML by specifying the width and height at which to display it, the way the image will appear depends entirely on the browser being used, and whether the original is re-sampled rather than simply pixel resized. Also, if you wish an image to be reduced in size, changing its dimensions from within HTML won't reduce the amount of data transferred from the server to the browser. Instead, try using this plug-in to resize images first. With it you can choose whether to resize an image on the fly before sending it to a browser, or you can save the resized image to the hard disk.

The Figure shows a 313 x 317 pixel image that has been resized to 500 x 100 pixels and, although it is now squashed, the resampling used has ensured that the new image remains smooth, and without the jagged edges a pixel resize would create.