OpenLayers Zoom (plugin for Omeka)
Tiles are automatically created when the selected image is saved.
This plugin is compatible with IIP Image realtime tiles server, which avoids creation and storage of tiles.
Tiles that are created follow the Zoomify format.
Visit the OpenLayers Zoom demo for more info.
PHP should be installed with the extension
exif in order to get the size of
images. This is the case for all major distributions and providers. At least one
of the php extensions
[Imagick] are recommended. They are installed
by default in most servers. If not, the image server will use the command line
Unzip OpenLayers Zoom into the plugin directory, rename the folder
if needed, then install it from the settings panel.
The viewer is displayed via three mechanisms, plus the old one. So, according to
your needs, you may use the default hook or add the code below in the
items/show.php file of your theme or anywhere else.
- Default hook
This hook is set by default, but an option allows to remove it.
- Helper (recommended)
This can be used anywhere in the theme. The record can be an item or a file.
<?php echo $this->openLayersZoom()->zoom($record); ?>
If a collection or an item contains multiple files and some are zoomed, and some
are not, you have to check if the image is zoomed. The
files_for_item() may be
replaced by such lines:
<h3><?php echo __('Files'); ?></h3> <div id="item-images"> <?php foreach ($item->getFiles() as $file): $isFileZoomed = $this->openLayersZoom()->isZoomed($file); // Zoom file markup. if ($isFileZoomed): echo $this->openLayersZoom()->zoom($file); // Standard file markup (see options in globals.php if needed). else: echo file_markup($file, array(), array('class' => 'item-file')); endif; endforeach; ?> </div>
Other useful functions, depending on your collection (when there are multiple file on an item and some are zoomed, other ones not):
$filesCount = $item->fileCount(); $zoomCount = $this->openLayersZoom()->zoomedFilesCount($item); $hasZoomedImage = (boolean) $zoomCount; $zoomedFiles = $this->openLayersZoom()->getZoomedFiles($item);
- Currently, only one shortcode can be added by page.
- In a field that can be shortcoded:
[zoom](default is the current item or file).
- Default in theme:
<?php echo $this->shortcodes('[zoom]'); ?>
- With all options:
<?php echo $this->shortcodes('[zoom record_id=1 record_type=item]'); ?>
- Old hook
This hook will be removed in the next release. In the
items/show.php of your
<div class="openlayerszoom-images"> <?php foreach ($item->Files as $file): fire_plugin_hook('open_layers_zoom_display_file', array('file' => $file)); endforeach; ?> </div>
Note that the id attribute
item-images of the div wrapper of the previous
releases has been replaced by the class
openlayerszoom-images to simplify
and is automatically added.
views/shared/css/OpenLayersZoom.css in your theme if you want to
modify the size/appearance of the zoom viewer.
Note: Some issues may appear on some browsers when multiple OpenLayersZoom are displayed on the same page.
Edit an item with an image attached to it. On the left is a zoom tab. Check the box next to the image thumbnail and save changes. The image will now be presented as a zoomed image in the public item page.
Currently, tiling is made without job process, so you may have to increase the
max allowed time (and the memory limit) for process in
It is possible to bulk create tiles with the script
provided at the root of the plugin. Simply edit it, set the collections or the
items to process, and run it:
# Go to the root of the plugin. cd /path/to/my/omeka/plugins/OpenLayersZoom # Edit the file to set the items to zoom (see instruction inside). nano bulk_build_tiles.php # To run the script. php -f bulk_build_tiles.php
The script can be launched multiple times: if a file is already tiled, it won’t retiled, but skipped.
IMPORTANT: Check or update the rights of the subfolder of
in particular when the folder of items was created by the server and you try to
For huge images, it’s recommanded to create tiles offline via a specialized
photo software, eventually with a Zoomify plugin, or to use a script that
ZoomifyFileProcessor.php library, else to use IIP Image.
If an IIP Image server is used, you have to add the query url for each item
that use it in the element
Tile Server URL of the element set
Item Type Metadata.
This element is hard coded in the code, and is not created during the install.
So you have to edit item types, then create this element, and add it to each
item type you use. Only one image can be used by item and it must be uploaded
too, because the widget should know the size of the image to compute the tiles
to ask to the server. To check your config, set the url from the official example
in the field
Tile Server URL, and upload an image with a size of 9911 x 6100
pixels (width x height). If the size is different, it is not important, but some
tiles may be misplaced. Anyway, it will proove that the plugin works.
Use it at your own risk.
It’s always recommended to backup your files and your databases and to check your archives regularly so you can roll back if needed.
See online issues on the plugin issues page on GitHub.
This plugin is published under GNU/GPL.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
First version of this plugin has been built by Matt Miller. Thanks to Nancy Moussa @ U of Michigan for bug fixes and individual unzoom feature. It has been improved by Peter Binkley for University of Alberta Libraries. The upgrade for Omeka 2.0 has been built for Mines ParisTech.
- Copyright Daniel Berthereau, 2013-2018
- Copyright Peter Binkley, 2012-2013
- Copyright Matt Miller, 2012
See copyrights for libraries in files inside