What is image_exact?
This is a simple utility module which extends image.module and user.module to allow admins to set exact sizes for image thumbnails from image.module, and for user avatars.
Many site designs look better if thumbs and avatars are all square, for instance, or at least always have the same aspect ratio. This module lets you have that by cropping images equally from all sides until the correct aspect ratio is reached, and then scaling.
Image_exact is designed to be a simple, lightweight solution for sites that just want exactly-sized avatars and/or images handled by image.module. If you're interested in dynamic image handling, we recommend the far more flexible and powerful imagecache.
In response to the requests from the group (and Ber Kessles doing most of the work), I've checked-in a 5.0 version of this module. It is still a development version, so may have some bugs to work out.
Imagecache as an alternative
Almost all the functionality of image_exact is present in the generally superior imagecache module. In order to create exact-size imagecache functionality, you do the following:
- Create a new imagecache preset for your exact size. I tend to like naming them with the dimensions so it's easy to remember what size I will be invoking. For instance, I have a site with 200px square images and I have called that setting square200.
- Add a filter which SCALES the image to your size, using your desired dimensions (e.g. 200x200). Be sure to set the "Scale to fit" is set to "Outside dimensions."
- Add a second filter with CROPS the image to your size (200x200 again, for instance), setting the x and y offset to "center."
- Invoke this preset in your theme by using imagecache's theme function like so: theme('imagecache', 'square200', $filepath).
Using Imagecache for avatars:
Use the Imagecache Profiles module.