Omeka Classic Logo
  • What’s new in Omeka
  • Tutorials
  • Reference
    • Global (Theming) Functions
    • Hooks
    • Filters
    • models
    • views/helpers
    • controllers
    • Packages
      • Acl
      • Application
      • Auth
      • Captcha
      • Controller
      • Db
      • File\Derivative
      • Filter
      • Form
      • Global Functions
        • Db-related functions
        • Locale-related functions
        • Log-related functions
        • Plugin-related functions
        • Search-related functions
        • Text-related functions
        • User-related functions
        • Utility-related functions
        • View-related functions
      • Http
      • Install
      • Job
      • Navigation
      • Output
      • Plugin
      • Record
      • Session
      • Storage
      • Test
      • Validate
      • View
    • libraries/Omeka
    • Omeka REST API
  • Helping With Documentation
  • Registering a new module or theme with omeka.org
Omeka Classic
  • Reference
  • Global (Theming) Functions
  • item_image_gallery — Get a gallery of file thumbnails for an item.
  • View page source

item_image_gallery — Get a gallery of file thumbnails for an item.

Item-related functions

Summary

item_image_gallery($attrs = array(), $imageType = 'square_thumbnail', $filesShow = null, $item = null)

Get a gallery of file thumbnails for an item.

Parameters:
  • $attrs (array) – HTML attributes for the components of the gallery, in sub-arrays for ‘wrapper’, ‘linkWrapper’, ‘link’, and ‘image’. Set a wrapper to null to omit it.

  • $imageType (string) – The type of derivative image to display.

  • $filesShow (bool) – Whether to link to the files/show. Defaults to null, uses ‘link to file metadata’ appearance option.

  • $item (Item) – The Item to use, the current item if omitted.

Returns:

string

Usage

Examples

Use the $attrs array to assign HTML attributes for each image in the gallery for an item.

Use 'wrapper' to set the attributes for gallery block div:

<?php echo item_image_gallery(
  array('wrapper' => array('class' => 'gallery')));
?>

Use 'linkWrapper' to set the attributes on the div that surrounds each image:

<?php echo item_image_gallery(
  array('wrapper' => array('class' => 'gallery'),
  'linkWrapper' => array('class' => 'admin-thumb panel')));
?>

Use 'link' to set the attributes for the a tag:

<?php echo item_image_gallery(
  array('wrapper' => array('class' => 'gallery'),
  'linkWrapper' => array('class' => 'admin-thumb panel'),
  'link' => array('class' => 'link')));
?>

Use 'image' to set the attribute for the img tag:

<?php echo item_image_gallery(
  array('wrapper' => array('class' => 'gallery'),
  'linkWrapper' => array('class' => 'admin-thumb panel'),
  'link' => array('class' => 'link'),
  'image' => array('class' => 'image')));
?>

Omit the default 'wrapper' attributes by setting it to null:

<?php echo item_image_gallery(
  array('wrapper' => null,
  'linkWrapper' => array('class' => 'admin-thumb panel'),
  'link' => array('class' => 'link'),
  'image' => array('class' => 'image')));
?>

Use the $imageType parameter to set which image derivative is used in the gallery. Available options are square_thumbnail, thumbnail, fullsize, and original:

<?php echo item_image_gallery(
  array('wrapper' => null,
  'linkWrapper' => array('class' => 'admin-thumb panel'),
  'link' => array('class' => 'link'),
  'image' => array('class' => 'image')),
  'thumbnail');
?>

Set the $filesShow boolean to true to link each image file to its file/show page:

<?php echo item_image_gallery(
  array('wrapper' => null,
  'linkWrapper' => array('class' => 'admin-thumb panel'),
  'link' => array('class' => 'link'),
  'image' => array('class' => 'image')),
  'thumbnail',
  true);
?>

See Also

Previous Next

© Copyright 2012-2023, Omeka.

Built with Sphinx using a theme provided by Read the Docs.