[SOLVED] Download file direct from album page thumbnail

andrew42

Joined: 2011-02-20
Posts: 4
Posted: Sun, 2011-02-20 19:25

Not sure if this is the right forum for this question.

I have a G2 site using the Matrix template and currently containing a significant number of photos. I want to be able to set up an album which can contain e.g: PDF files. In these cases clicking the thumbnail first presents a large version of ImageMagick's thumb. To download, the user must then (identify) and click "Download document in original format".

I would like the initial click to result in immediate download - but only in the case of non-image files. A quick surf around the forum indicates that a mod to album.tpl is needed, but how can you identify whether the file is PDF or something else?

Very grateful for any help.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-02-20 23:26
{if $child.mimeType == 'application/pdf'}
  {capture assign=linkUrl}{g->url arg1="view=core.DownloadItem"
              arg2="itemId=`$child.id`"}{/capture}
{else}
  {capture assign=linkUrl}{g->url arg1="view=core.ShowItem"
              arg2="itemId=`$child.id`"}{/capture}
{/if}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
andrew42

Joined: 2011-02-20
Posts: 4
Posted: Mon, 2011-02-21 09:01

Thanx Suprsidr - works a treat!