Gallery2:Image Size Settings - Gallery Codex
Personal tools

Gallery2:Image Size Settings

From Gallery Codex

Image Size Settings

This article describes the different types of image versions in Gallery 2 and how to manage them.

Introduction

Gallery 2 (G2) shows the images that you've uploaded on your website. Additionally, G2 generates small preview images, so called thumbnails, for all images that you upload. If you haven't changed the theme settings yet, then G2 will show up to 9 of these thumbnails on a preview page (album page).

If you then click on one of these thumbnails, G2 will show you a larger version of the image along with the image name, description and other details. If you haven't changed the settings yet, then you will see a downsized / intermediate sized version of the image that you have uploaded, a so called resized image or resize. You can configure an unlimited number of intermediate sized images and a list of all available versions of this image is in the upper right corner of the (photo) page.

In the upper right corner you should see a link to the full-size image, that's the original image that was uploaded to Gallery 2 in its full size.

If the original image is in a non-webviewable format (tiff, wmf, tga, ...), then you should also see a download link to download the original image. In this case, the full-sized image is a web-viewable image (JPEG format) of the same dimensions as the non-web-viewable original image.

Note that this behavior of what you see where and what happens when you click thumbnails, resizes etc. is all up to the theme that you're using. Here we describe the behavior of the default theme (matrix).

Requirements

Gallery 2 will only generate thumbnails and resizes if at least one of the image toolkit modules is active (imagemagick, netpbm, gd, ...).

Also, not all image toolkits can handle all image formats. ImageMagick supports the widest range of image formats. It can even generate thumbnails and resizes for PDF documents, eps graphics, etc.

Note that your imagemagick/gd/netpbm might not support the full list of the file types that G2 supports. It depends on how your imagemagick/netpbm binaries or gd library/php was compiled.

For a full list of supported file types please see: Supported MIME Types

Configure Image Sizes

For site-wide default settings, browse to your root album and click Edit Album and click on the Album tab.

Notes:

  • You can set different thumbnail and resize sizes for each album if you want to. Just browse to an album and click Edit Album.
  • There is no upsampling of your images in G2, that is, if your resize size is larger than the original image, it does not create that resize and if the thumbnail size is larger than the original, it uses the original as the thumbnail.
  • New albums inherit the settings from its parent album. So you should set the sizes in the root album if you want that new top-level albums have the thumbnail and resizes dimensions that you prefer.

Thumbnail Size

  • You can set the maximal size in pixels for thumbnails.

The aspect ratio of the generated thumbnail will be the same as the one of the original full-size image. If your original image has the ratio 4:3 of width to height and you chose 160 as the thumbnail size, then your thumbnail will have the dimensions 160 pixel in width and 120 pixel in height.

If the squarethumb module is active, all thumbnails will be generated with square dimensions, that is their width is the same as their height, independently of the aspect ratio of the original.

Notes:

  • You can set a cropped thumbnail manually for each photo by browsing to a photo and clicking on Edit Photo and then on the Crop Thumbnail tab.
  • You can upload an unrelated / specific image as thumbnail for any item. Activate the thumbnail module and browse to the album / photo and click on Edit Album / Edit Photo and then on the General tab to use the custom thumbnail upload option at the bottom of the page.
  • Thumbnails for albums are called highlight or album highlight since this single thumbnail represents all photos of this album.
  • G2 picks the first image that was added to an album as the album highlight. You can change the album highlight by browsing to a photo of the album and clicking Make Highlight.
  • If you want that the thumbnail for an album changes randomly to showcase all the photos of the album as album highlight, activate the randomhighlight module for that album.

Resize Size

  • You can set the maximal dimensions in pixels for each resize. The [ ] x [ ] input fields are for width (left box) and height (right box) of the resize.
  • You can set an arbitrary number of intermediate sized images by entering dimensions.
  • You can set the priority / order of the resizes. The resize dimensions at the top of the list are shown as the default resize etc. The order in which you list the dimensions in edit album -> 'album' is the order in which the resize versions are listed in the resize list shown of on each photo page.

The aspect ratio of the generated thumbnail will be the same as the one of the original full-size image. The dimensions you enter for the resize version are maximums in pixels for the width and the height.

Notes:

  • Different resize sizes for each photo in an album are also possible. Browse to a photo and click Edit Photo and then on the Photo tab.

Full-Size Size

The dimensions of the original full-size image are unchanged unless you explicitly change them. If you deal with 8 MegaPixel images from your latest digital camera, you might want to resize (down size/down sample) the images before you upload them to G2 to save bandwidth and webspace.

Notes:

  • Gallery Remote can resize the images on upload for you
  • G2 can resize your original files automatically for you when you add them if the sizelimit module is active and a sizelimit is defined for the album in Edit Album in the Album tab. The original file will be resized and and the resized version will be stored as the new original and the old original will be deleted.
  • You can resize images in G2 manually by browsing to a photo and clicking on Edit Photo, then on the Modify Photo tab.

Change Existing Image Sizes

Changing existing thumbnail and resize sizes in G2.0/2.0.1/2.0.2 is a pain. You have to go to each album, one by one, and edit the settings there.

In G2.1 and later versions (and in the current nightly snapshots) you can change the settings recursively if you want to. That is, if you want to change the thumbnail size for all albums, browse to your root album, click Edit Album and then change the settings with the Use this thumbnail size in all subalbums checkbox ticked.

The new settings are only used for new images, that is, for images that will be added to this album in future. The thumbnails and resizes of existing images will not be changed unless you tick the Recreate thumbnails and Recreate resized images checkboxes respectively.

Generating Thumbnails and Resizes

You don't have to bother about generating thumbnails and resizes. They are generated automatically when they are needed. Since generating images is computationally expensive (it takes a moment to create a thumbnail or resize) you may want to have complete control on when exactly these images are generated.

A few add item methods (e.g. add item -> from browser) offer the Create thumbnails now in the upload view which forces G2 to generate the thumbnails right when the image is added and not later when it is first used. There is no such option for resizes yet.

You can force to generate / build all thumbnails and resizes of the whole installation by browsing to Site Admin -> Maintenance -> Build all thumbnails/resizes. This task can take hours if you have thousands of images, but it can also finish in a few seconds for only a few images if your server is fast enough. Note that during the execution of this task your server will be slowed down considerably. You may also want to put G2 into maintenance mode (see config.php) during this operation.

Thumbnails and resizes are not generated on each request. That would be too slow. Instead they are generated when they are first requested and then they are stored on the harddisk of your server. Note that thumbnails and resizes are derived from the original, thus we call them internally derivatives. That's why they are stored in cache/derivative/ in your G2 storage folder (usually g2data/).

advertisements