Tweaking rules for thumbnails and icons

I'm about the import hundreds of vertical images, and I know that most of the icons and thumbnails will decapitate most of the human figures. 
I'm hoping that that can find a way through MEDIA_TRANSFORMATION_RULES to adjust these so that when they're generated it doesn't take the icon chunk out of the middle but rather starting at the top. Can anyone give me a nudge on which values to start with? Thanks!


  • Hi ajhartley,

    media_processing.conf sets all of the rule for creating image derivates - you can create your own custom image versions if needed.  You can also always go back and run reprocess-media if they don't turn out the way you expected at import (
  • Thanks, Sophie. The command-line reprocess is a good tip for rapid reprocessing, and for those who try this, you can optionally specify a range of images by id number. So if you needed to do a batch that is sequential, you can center in on just those images (or even experiment with just a couple over an over). 

    For those who might run across this topic in the future, the possible values for these image rules are in the source code for gmagick.php. (Anyone who has better info, please correct me; that's where I found them.)  Possible values for mode are fill_box, bounding_box, width and height. Possible values for crop_from (which is only used in fill_box mode) are center, north_east, north_west, south_east, south_west and random. (I tried 'north' and 'south', but it wasn't supported in my install for cropping, though I think it might for watermarking.)

    It looks like if your site only uses gd and not gmagick or imagick, most of these attributes may be ignored. 

    For my purposes with this batch, I set any square thumbs or previews to be mode = fill_box and crop_from = north_east.

    Antialiasing is a value that helps simplify the numbers of colors in the thumbnail. I left it at 0.5; if you go down to 0, you'll get a solid black thumbnail. I bumped up the quality from 75 to 90. Honestly, though, most people glance so quickly at them that 75 would probably be fine.
  • Very useful. Thanks !

Sign In or Register to comment.