News Archive
PhpRiot Newsletter
Your Email Address:

More information

Creating Thumbnails in Recite

This article is the first in a series giving you various tips on using Recite CMS. We'll frequently post new hints and tips on this blog.

One of the great features of Recite CMS is the ability to easily create image thumbnails. This is especially useful if you want to display an image gallery on your web site.

When creating a template, simply use the {thumbnail} template function. This function accepts the following arguments:

  • path - This is the path to the image on your web site
  • w - The maximum width of the thumbnail (in pixels)
  • h - The maximum height of the thumbnail (in pixels)
  • pad - If you specify true then the image will be shrunk to fit within the specified size and whitespace will pad to make it the exact size. The longer dimension is shrunk to fit.
  • crop - If you specify true then the image will be shrunk by the shorter dimension so it fits in the specified dimensions. The image will be the exact size specified but some of it will be cropped.

If the thumbnail isn't padded or cropped, it will be sized to fit within the specified width and/or height, but the resultant image may not be exactly the dimensions.

Use the {thumbnail} function within your HTML links or images. The following code demonstrates this:

You can also link to a larger version of the same image with the same technique. The following code would output a small thumbnail then link to a medium sized version of the image:

Creating an Image Gallery

If you wanted to add an image gallery on your web site, you would add the File Listing container rule to list files from a chosen directory.

When creating the template to output these images, you would use a template similar to the following:

{foreach from=$content item=row} {/foreach}