Topic: How can I change the image resizing options from the default.

Topic type:

The default images sizes that Kete makes may not be right for your site, here's how to change them.

Note: we recommend making this change to your site's configuration before you start adding live content, so that image sizes remain consistent.


  1. login to your site as a user that has the "tech admin" role, such as the original administrator account
  2. click reconfigure site in the Administrator's Toolbox
  3. click Advanced Options
  4. click Images
  5. change the value in the Images Sizes field to suit - see notes below about format - Very important!
  6. click Save
  7. restart your server - your changes won't go into action until this is done

The Image Sizes field comes in a very specific format that is passed to some underlying third party software that Kete relies on for the image resizing functionality. Here are the rules you must follow:

The names of the sizes that you want to make available start with a colon and their resizing specifications follow a "=>".  For example:

:small => '50'

These definitions must be surrounded by "{" and "}" and have commas separate the sizes' definitions. For example, here is the current default settings:

{:small_sq => '50x50!', :small => '50', :medium => '200>', :large => '400>'}

Kete always expects a ":small_sq" option at this point, but you may adjust its dimensions.  You may subtract any of the other size definitions, however.  You may also define additional (or different) size definitions, too.

The numbers represent size in pixels.  The format '50x50!' means crop the image to those dimensions.

If there is only one size, such as ":small => '50'", it means that the image will be resized proportionally, but the maximum dimension of height or width must be at or below the number specified.

If there is only one number, such as ":medium => '200>'", it means that the maximum width will be what is specified, and the image will be resized proportionally.  Thus the height is not constrained by a maximum dimension.

Resizing images when settings change

If you change the image size settings, very shortly you'll realise that existing images still adhere to the original sizes.

As of Kete 1.3, there is a rake task included that allows you to run through all images on the size and resize them to what they should be.

Note: If you have many images ( say more than 500 ), or you have a log of big photos (2000x1000 pixel dimensions) then the rake task will consume a lot of resources and take quite while. For sites with either lots or big image files, you may want to run your rake task at a time when your site doesn't see much use (overnight, on the weekend, etc.).

To start the rake task, open up and run the following. Change RAILS_ENV to suit.

$ RAILS_ENV=production rake kete:tools:resize_images

This will loop over every original image file, and resize/create imags for any changed or new settings in the images sizes settings.

When done, it'll output how many were resized, and how many were created. For a more detailed process, a log file is created and written to. You can find it at log/resize_images_2009-07-03_17/38/13.log  (the timestamp will be different than the one printed here).

Discuss This Topic

There are 0 comments in this discussion.

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
How can I change the image resizing options from the default. by Walter McGinnis is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License