Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint:
Making Quality Images (only smaller)
Apr 17, 2003 @ 12:03:48

If you've ever worked with images in PHP, you know it can be a headache when it comes to resizing them. The GD libraries make it anything but easy, and the ImageMagik software can clutter up your hard drive with all sorts of other images and thumbnails. Another alternative, though, is talked about in this new piece from SitePoint and makes use of only one function - getimagesize().

Now, obviously, this method won't work for making large images smaller since it just adjusts the img tag, but it can be useful if the starting images aren't that large to begin with. The example the author gives here is the idea of products, like in an ecommerce catalog. Generally, the images are pretty small anyway, but reducing their size a bit more allows for more information on the page, and that wonderful "click to enlarge" option that's there on so many sites.

There are better ways to do this than just an img tag, but for something small, this just might do the trick. Besides, it saves the hastle of having to learn GD...

tagged:

Link:


Trending Topics: