I am trying to make a generic thumbnail image (or multiple images for different item types if possible) for items without images uploaded to their record.
This recipe from the Omeka documentation seems to describe what I want: http://omeka.org/codex/Recipes/Default_Item_Thumbnail_Images But I think it is for an earlier version of Omeka. I am using 2.0.4 and my code is slightly different than described there, and the code this page suggested led to a fatal error on my site.
Am I missing an obvious way to do this? If not, could someone please help me out with modifying the code?
Thanks so much!
Yes, many of the functions have changed for Omeka 2.0. This list of changes will help get a start.
Two of the biggest changes are in how loops work (a little further down the page from the link), and using the metdata() function instead of
item() to get information about the item. For example, to get the item type name, you would do
Hope that gives a start
Thank you for the tip, Patrick.
After much work (I am really new to PHP) I finally figured it out!
Default Item Thumbnail Images for Omeka 2.0
The file to edit is:
I copied this file to my theme directory here:
Find this code:
<?php if (metadata('item', 'has thumbnail')): ?>
<?php echo link_to_item(item_image('square_thumbnail')); ?>
<?php endif; ?>
And replace it with this code:
if (metadata('item', 'has thumbnail')):
echo link_to_item('<img src="your_default_image_url.jpg">');
Whatever image you have as your_default_image_url.jpg will automatically be appropriately resized. This code will allow you one default thumbnail for all items without an image.
I do plan to assign different images to different types of items, but that will have to wait for another day. I'll post that code here as well, to make it easier for others who want to do this.