Link to the original image


I’ve been talking about this topic with anoher user there: Preview of items instead than going to the items page, but i tought that the problem is interesting enough to make it’s own post. The question is, How can you make that when omeka s renders, the media-rederer links directly to a media file (the original image) instead than to an item that contains the image

To clarify this site im working on is made for exhibits, im not touching anything that has to do with databases, so what i really want is how the layout.phtml prints the html code:

What happens:

What i want to happen in the page itself:

If anyone knows please tell me

What code is being used on your page that’s causing this output? Your code looks like it’s on a browse page, and the browse pages don’t usually call to the “render” function.

I assume from the markup that it is a call to render: if so, there’s just a link argument that the function accepts which changes where it links to. If it’s not passed at all it goes to the URL for the original (as in your second example), but it can take 'item' or 'media' to link to the respective pages instead.

So your browse view possibly is just calling render with a ['link' => 'item'] argument that you could simply remove if you want the link to instead be to the original.

1 Like

Thanks for the reply!

I think there has been a misundererstanding and its because i explained the problem poorly, as you said the browse page doesn’t have the render function, the show page has it, and all of the changes i’ve been trying have been inside the omeka theme Thanks, Roy 1.0.1.

And the thing im tring to make is that when a page is generated, im using something similar to lightbox called maginfic-popup and i want use it to previsualize an image when clicking it instead to go to the item page. And the pop up works properly the thing is that it cannot find the image because there is the item first

The problem is trying to find the code that generates this output and i think it could reside in two places:

  • The place where the page generates the blocks, and the media on those blocks generates the link to the item (i have absolute no idea where this is found)

  • Somewhere in the item itself either the browse or the show, that calls itself to be generated (here is where i’ve been doing most of my tries)

Im using the verision of Omeka S 3.2.3, and the theme Thanks, Roy without any modifications from the default

Thank you for your time! and as always if anyone knows anything that could help feel free to tell me!


I’ve been able to find how to link to the direct to the original image, if anyone wants to do this for exhibits i would recomend:

  1. reading this original post: Lightbox for Items show page for Omeka S and following the instructions

  2. then put the magnific pop-up in a script at the bottom of the layout.phtml and add the pdf type

  3. and finally the last step is to go to application>view>common>block-layout
    once you are here you’ll see all the types of media that can be uploaded to omeka

so you pick the ones you want to see directly that generally it would be the file.phtml and the item-showcase.phtml

and in this piece of code eliminate the link and put the original URL

$media = $attachment->media() ?: $item->primaryMedia();

    if ($media):
        //echo $media->render([
	        //'thumbnailType' => $thumbnailType,
            //'link' => $link,
       // ]);  
	echo $media->render([
	        'thumbnailType' => $thumbnailType,

4.Once this is done it will generate the link to the original URL instead of the item, so the magnific pop-up will work correctly. Here you will find a problem that it works pefectly with images but not with documents, soo you have to find another way

If you’re just talking in the context of a site page, with a media block, where that link goes is controlled by a setting on the site. The “Attachment link type” setting in the site settings can be set to “Direct link to file” and you’ll get the direct “original” link you want, without editing the view.

1 Like

:smiling_face_with_tear: welp its good to know now.

Thank you very much anyways :grin:!