Image attached to Exhibits

29 views
Skip to first unread message

Nancy Moussa

unread,
Feb 22, 2016, 1:59:27 PM2/22/16
to Omeka Dev
Hi

The new version of Omeka 2.3 will attach a thumbnail image to each exhibit.

I understand that all attached images in pages related to exhibit stored in omeka_files table.

This is the sql command that will fetch an image if you give an exhibit id.

select filename from omeka_files
Inner join omeka_exhibit_block_attachments oattachments
on oattachments.file_id = omeka_files.id
Inner join omeka_exhibit_page_blocks pb on
pb.id = oattachments.block_id
Inner join omeka_exhibit_pages ep on ep.id = pb.page_id 
Inner join omeka_items items on items.id = omeka_files.item_id where
omeka_files.has_derivative_image = 1 and ep.exhibit_id=?;

What I am struggle with where you tell to retrieve the first thumbnail image only if the page has more than a block and each one has an image.

I appreciate the help.

Currently this sql statement will return three images where each attached to each block in the exhibit_page.

Thanks
Nancy

Patrick Murray-John

unread,
Feb 22, 2016, 4:11:05 PM2/22/16
to omek...@googlegroups.com
Nancy,

I'm not entirely sure this will tell you what you need, but here's an example of the sql that exhibit builder uses:

SELECT `files`.* FROM `omeka_files` AS `files`
 INNER JOIN `omeka_items` AS `items` ON items.id = files.item_id
 INNER JOIN `omeka_exhibit_block_attachments` AS `eba` ON eba.file_id = files.id
 INNER JOIN `omeka_exhibit_page_blocks` AS `epb` ON epb.id = eba.block_id
 INNER JOIN `omeka_exhibit_pages` AS `ep` ON ep.id = epb.page_id WHERE (ep.exhibit_id = 11) AND (files.has_derivative_image = 1) GROUP BY `files`.`id` ORDER BY `ep`.`order` ASC, `ep`.`parent_id` ASC, `epb`.`order` ASC, `eba`.`order` ASC LIMIT 1

It's built in this part of the getFile() function on the Exhibit model

Does that help address what you need?
Patrick
--
You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omeka-dev+...@googlegroups.com.
To post to this group, send email to omek...@googlegroups.com.
Visit this group at https://groups.google.com/group/omeka-dev.
For more options, visit https://groups.google.com/d/optout.

Nancy Moussa

unread,
Feb 23, 2016, 3:33:03 PM2/23/16
to Omeka Dev
Thanks Patrick,

Yes I am referring to this function, but this is for a single exhibit id. If I alter this function and join the omeka_exhibit table to get an image for each exhibit, the function will not work. It will output a list of images for an exhibit.

I just need one image to each title, and I guess the plugin try to get the first image attached to the first page or first block? can you say more about that!

Thanks
Nancy
Reply all
Reply to author
Forward
0 new messages