Training

Our next U.S. stop:

Mike Anello and Andrew Riley from Mediacurrent are teaming up to offer the first Blue Collar Git workshop on Friday, June 8 as part of DrupalCamp Charlotte (also part of the Southeast LinuxFest). The cost is only $149 for the full day if you register during the month of May ($199 otherwise). 

New Podcast

Posted Wednesday, May 9 at 7:50 am
Brandon Morrison (Brandonian on drupal.org) joins Andrew Riley and Mike Anello on the first post-DrupalCon Denver edition of the podcast to talk about all things Geo in Drupal 7. Brandon is one of the maintainers of the GeoField module and is an active member of the Drupal Geo community.
Download Podcast 82
DrupalEasy_ep82_20120509.mp3
Syndicate content

Newsletter

Stay up-to-date on DrupalEasy workshops and other events. On average, we send about one newsletter per month.

Testimonial

Mike is a great teacher!

Who are we?

DrupalEasy is the collective expertise of Ryan Price and Michael Anello, who joined forces to provide training and consulting services worldwide. Read all about them and what they can do.

What is Drupal?

Drupal is a free, super-powerful content management system for sites that require information posting and collection, including blogs, forums, videos, photos, and databases of information. We think it is the best platform available. Here's why...

Why Drupal?

More and more savvy organizations are going with Drupal for content management, and its no mystery why. It’s free, flexible, and easy to maintain for small or large volume sites. Learn more...

Simple and exact image cropping

We all know imagecache is a great module to grab images of any size that are in your site's files/ directory, but sometimes it's hard to get every image to be the right size without black borders on the sides or top. The trick is to know the proper "order of operations".

Here's a fast recipe for square thumbnails that will work with landscape or portrait picture orientations:
Scale - width: 85, height: , upscale: No
Crop - width: 85, height: 85, xoffset: , yoffset: top
Scale And Crop - width: 25, height: 25

This is a recipe I use for user profile pictures, and it handles very wide or tall images well. Adjust the values proportionately to fit your needs. Step 3 is an optional step I apply in order to make a super-small thumbnail in certain places in the theme.

NOTE: the original size of the picture in this case is usually larger than 170px, but at the very least, it should be larger than the size of the initial scale. If you are starting with a very small picture, this recipe won't work as well.

Trackback URL for this post:

http://drupaleasy.com/trackback/123
No votes yet

More Quicktips


1 comment

Guest wrote 1 year 27 weeks ago

Thanks

Thank you very much for this post.
This was very helpful to me as I am very novice to drupal.
The "Scale And Crop - width: 25, height: 25" had gave me a bit small thumb than what I have assumed so I have edited it to "Scale And Crop - width: 40, height: 40", Then it gave me the exact thumb what I have assumed for.
Thank you very much again for this tutorial.

Pradeep.

Guest wrote 2 years 27 weeks ago

Thanks

Thanks for this tutorial. However, I'm still having problems with landscape images. I scale with width, in my case to 188, no height, not upscaling. I then crop to 188x188 with the yoffset of top. Portrait images work great, perfect width with bottom cut off. Landscapes, however, each have a black bar across the bottom.

I suppose I could scale huge and then crop, but I'm wanting as much of the image in the thumb as possible.

Syndicate content