How to get a link to an image?

atreus

Joined: 2009-08-18
Posts: 3
Posted: Tue, 2009-08-18 22:45

I have a link to the "download photo" which links directly to the original image. The (existing) code in the theme is

<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.sourceImage.id`"}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}

I'd like to also have a link to the resized image that is being displayed on that page. IE, a link directly to the resized image, not the original.

I can right click on the image, and select "copy image location", but I want to actually provide a link.

I just need a way to get the item id# of the image. Is there a variable for this? I tried $theme.image.id but that didn't work.

The link I'm looking to generate looks like:

http://www.example.com/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=271

The gallery site is embedded (in drupal) if that makes a difference.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Tue, 2009-08-18 22:48

Check out this plugin: http://codex.gallery2.org/Gallery2:Modules:geturls
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
atreus

Joined: 2009-08-18
Posts: 3
Posted: Tue, 2009-08-18 23:34

Thanks for the link to the module, but I'd prefer do this via templating if possible. Also, the geturls module doesn't seem to be included in the "full" installation for some reason.

It seems like there should be an easy way to grab just the image id, I just don't know what all the variables are.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Tue, 2009-08-18 23:38

There are lots of plugins not included in the full install. :) Only official plugins that were maintained by the Gallery dev team was included in those builds. The geturls plugin is a a 3rd party/community plugin.

If you're looking for the variables and their values, take a look at the Smarty Debug popup window that is generated when you put Gallery into debug mode:
FAQ: How to set/use Gallery in debug mode?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
atreus

Joined: 2009-08-18
Posts: 3
Posted: Wed, 2009-08-19 00:38

Thanks for the (fast) help, debug mode is extremely helpful!

The link ended up looking like this (went in themes/siriux/templates/local/photo.tpl)

<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.imageViews.0.id`" forceFullUrl=false forceSessionId=false}">
{g->text text="link text"}
</a>