Adding Images to a Collection Description

I want to punch up Collection pages by adding images.

Question 1:
I've added the Featured Items thang to my theme's /collections/ PHP files. Will it pull featured items from any collection, or will it automatically limit to items in that collection? If the former, is there an easy way to hack this?

Question 2.
Is there a method (or a theme) that allows one to associate an image to a collection? Like Items with images, this picture would follow the Collection around. The picture would appear on the Collection's page. A smaller version of it would appear on the page for browsing collections.

This is a similar concept to "post thumbnails" in WordPress.


I am have a theme where I am working on similar functions. This is not working quite the way I would like yet, but it might give you ideas.

Question 1: Featured Items pull items from any collection.

I made a column on the home page to get a random featured collection (which if one could set to a specific collection), and then show 3 items from that collection.

<!-- Featured Collection -->
<div id="featured-collection">
<div class="block">
<?php echo display_random_featured_collection(); ?></div>

<!-- Get Current Collection -->
<?php echo get_current_collection(); ?>

<div id="feature-items">
<div class="items-list">
<div class="collection-item">

<!-- Get Items in Current Collection-->


<?php set_items_for_loop(loop_items_in_collection(3));?>

<?php if (has_items_for_loop()): ?>

<?php while (loop_items()): ?>

<!-- Display Items in Current Collection -->

<h3><?php echo link_to_item(); ?></h3>

<!-- Display Thumbnail -->
<?php if (item_has_thumbnail()): ?>

<div class="collection-img">

<?php echo link_to_item(item_square_thumbnail()); ?>
<?php endif; ?>

<!-- Display Item Description -->

<?php if ($desc = item('Dublin Core', 'Description', array('snippet'=>300))): ?>

<div class="description"><p><?php echo $desc; ?></p></div>

<?php endif; ?>

<?php endwhile; ?>

<?php else: ?>
<p>No recent items available.</p>

<?php endif; ?>

<!-- Link to Collection -->

<p class="view-items-link">">View All Items</p>

</div><!--end collection-items -->

This is kind of bulky. I am working on a helper fu

Question 2

Collections aren't associated with images, only a description. It seems they are more of an organization scheme than a display function. I am working on a spared down version of the code above that just brings in an item thumbnail by id,
then styles the .collection-description and .collection-img classes. Again this is clunky. I would like to create a function similar to display_random_featured_collection(), that would at least pull the item img into a reusable helper.

I think I figured out an answer to question 2, so that an the first image of a collection will appear next to the collection description.

<?php set_collections_for_loop(recent_collections(5)); ?>
<?php while (loop_collections()): ?>
	<div id="collection">
		<div class="item">
			<?php while (loop_items_in_collection(1)): ?>
    				<?php if (item_has_thumbnail()): ?>
    					<div class="item-img">
			    			<?php echo link_to_collection(item_square_thumbnail(array('alt'=>item('Dublin Core', 'Title')))); ?>
    				<?php endif; ?><?php endwhile; ?>
				<h2><?php echo link_to_collection() ?></h2>
	        		<div class="element">
 	 	          		<div class="element-text">
					<?php echo nls2p(collection('Description', array('snippet'=>300))); ?>


		<div class="element">
            	<?php if(collection_has_collectors()): ?>
				<div class="element-text">
                    		<p><?php echo collection('Collectors', array('delimiter'=>', ')); ?></p>
            	<?php endif; ?>

	<?php echo plugin_append_to_collections_browse_each(); ?>

	</div><!-- end class="collection" -->
<?php endwhile; ?>

I am trying to get this to work for version 2.0.1.
The above code looks good, but isn't quite working for me.

I would really like to add a specific thumbnail to each collection and this page makes it look like we should be able to embed objects within Dublin Core fields:

However, when I use the TinyMCE editor, the image will show up, but when I click "Save Changes," it disappears. Is there a place where I can code the elements to accept images?


Okay, getting closer. Realized that under "settings" on the main page there are several options to play with, such as filtering of html and adding in allowable attributes.

Suggestion: perhaps the html settings should be mentioned on the TinyMCE codex page? Thanks!

Those HTML filtering options are new in Omeka 2.0, and I see that the TinyMCE codex page is definitely based on Omeka 1.x.

We'll get on updating that page, or making a 2.0-specific version of it.

It would be extremely helpful if there was the possibility to assign an image which is part of a collection, as the "cover image" for that collection. Especially when using random_featured_collection() on the home page, it would be nice to have the option of displaying an image along side the information.

Ideally this should be done in the Collections configuration menu of that specific collection and be not part of the Dublin core metadata set of that collection, but rather a collection specific setting.

A possible scenario for settings could be:

  • Set Specific image
  • No image defined - default to first
  • No image defined - don't display
  • No image defined - display random

I would be curious as to whether the dev team has considered this feature at some point or another.

We have, and it has come up in a variety of variations recently. The general idea that we have heard is a desire to have a free-standing image (that is, not attached to an item) associated with different records, such as collections, exhibits, simple pages, etc.

So, this is a feature that we know people want, but that Omeka and its themes aren't quite ready to handle without some major changes. I anticipate that it will appear in Omeka at some point, though.

I suppose collections, exhibits and simple pages would - for the most part - all require a different approach.

But I think that especially for collections the most logical assumption would be to use an image that is attached to a collection - like a cover image for a photo album to use an analogy. This seems like the most simple implementation, since it would only require the referencing of an existing item to the collections object.


I've just started testing Omeka and I just wanted to check that there is still no easy way to associated an image with a collection (as there is with items)?



There's no way to attach a file to a collection in the same way as images. But as of Omeka 2.2, you can return a thumbnail for a collection--it selects an item from the collection to generate the thumbnail (preferring featured items). The shortcode for collections will return a thumbnail.


Gretings - is anyone else having trouble sharing a collection on Facebook? I'd like a default image to show up when I share the file, as it's a visual archive, but only the words for the collection show up. This generally happens when no thumbnail is associated with the collection, but based on the above comment, I get the sense that 2.2 now supports thumbnails associated with collections...

Does a representative image for the collection show up in Omeka, but not Facebook? If so, I'd guess that FB isn't picking up the image for some reason.

FB looks for special tags in the HTML to specify the image to use, and Omeka themes currently do not add them. I'm not sure how much work FB does to find an image that isn't in the special tags.