5 US$ bounty to add download link

kobitriki

Joined: 2008-10-29
Posts: 21
Posted: Fri, 2008-12-12 09:08

Hello!

I would like to add a small download icon (download full size as file) next to the "View full size" icon.
(the site is freehdphoto dot com)
this is the photo.tpl :

Quote:
{*
* $Revision: 1.3 $
* If you want to customize this file, do not edit it directly since future upgrades
* may overwrite it. Instead, copy it into a new directory called "local" and edit that
* version. Gallery will look for that file first and use it if it exists.
*}
{if !empty($theme.imageViews)}
{assign var="image" value=$theme.imageViews[$theme.imageViewsIndex]}
{/if}
{if !empty($theme.params.sidebarBlocks)}
{g->theme include="sidebar.tpl"}
{/if}
<table class="gcBackground3" width="800" cellspacing="0" cellpadding="0" align="center">
<tr valign="top">
<td>
<div id="gsContent" class="gcBorder1">
<div class="gbBlockTop">
<table>
<tr>
<td class="gsActionIcon">
<div class="buttonShowSidebar"><a href="javascript: slideIn('sidebar')" title="Show Menu"></a></div>
</td>
{if (isset($links) || isset($theme.itemLinks))}
{if !isset($links)}{assign var="links" value=$theme.itemLinks}{/if}

{foreach from=$links item=link}
{if $link.moduleId == "slideshow"}
<td class="gsActionIcon">
<div class="buttonViewSlideshow"><a href="{g->url params=$link.params}" title="{$link.text}"></a></div>
</td>
{elseif $link.moduleId == "comment"}
{if $link.params.view == "comment.ShowAllComments"}
<td class="gsActionIcon">
<div class="buttonViewComments"><a href="{g->url params=$link.params}" title="{$link.text}"></a></div>
</td>
{/if}
{/if}
{/foreach}
{/if}
</tr>
</table>
</div>

<div class="gsContentPhoto">
<table align="center" cellpadding="0" cellspacing="0">
{if $theme.params.navigatorPhotoTop}
<tr>
<td class="gbNavigatorPhoto">
<div class="gbNavigator">
{* {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} *}
{g->theme include="navigator.tpl"}
</div>
</td>
<td>
{g->text text="&nbsp;"}
</td>
</tr>
{/if}
<tr>
<td>
<div id="gsImageView" class="gbBlock">
{if !empty($theme.imageViews)}
{capture name="fallback"}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"
forceFullUrl=true forceSessionId=true}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}
</a>
{/capture}
{if ($image.viewInline)}
{if isset($theme.photoFrame)}
{g->container type="imageframe.ImageFrame" frame=$theme.photoFrame
width=$image.width height=$image.height}
<div id="photo">
{g->image id="%ID%" item=$theme.item image=$image
fallback=$smarty.capture.fallback class="%CLASS%"}
</div>
{/g->container}
{else}
<div id="photo">
{g->image item=$theme.item image=$image fallback=$smarty.capture.fallback}
</div>
{/if}
{else}
{$smarty.capture.fallback}
{/if}
{else}
{g->text text="There is nothing to view for this item."}
{/if}
</div>
</td>
</tr>

{if $theme.params.navigatorPhotoBottom}
<tr>
<td class="gbNavigatorPhoto">
<div class="gbNavigator">
{* {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} *}
{g->theme include="navigator.tpl"}
</div>
</td>
<td>
{g->text text="&nbsp;"}
</td>
</tr>
{/if}
</table>
</div>

<table align="center" width="70%">
<td align="left" valign="top">
<div class="gsContentDetail">
<div class="gbBlock">
{if !empty($theme.item.title)}
<h2> {$theme.item.title|markup} </h2>
{/if}
{if !empty($theme.item.description)}
<p class="giDescription">
{$theme.item.description|markup}
</p>
{/if}
</td>
</table>

<table align="center">
<td align="center" width="240" valign="top">
{if $theme.params.showMicroThumbs}
<div class="gsContentDetail gcBorder6">
<div class="gbNavigatorMicroThums">
{g->theme include="navigatorMicroThumbs.tpl"}
</div>
<script type="text/javascript"><!--
google_ad_client = "pub-";
/* 468x15, 11/12/08FHDP-text */
google_ad_slot = "";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
{/if}
</td>
</table>

<table align="center" width="65%">
<td align="left" valign="top">
<div class="gbBlock">
{g->block type="core.ItemInfo"
item=$theme.item
showDate=false
showOwner=false
showViewCount=false
class="giInfo"}
</div>
<div class="gbBlock">
{* Show the photo blocks chosen for this theme *}
{foreach from=$theme.params.photoBlocks2 item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
</div>
</div>
</td>
</table>

{* Download link for item in original format *}
{if !empty($theme.sourceImage) && $theme.sourceImage.mimeType != $theme.item.mimeType}
<div class="gbBlock">
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}">
{g->text text="Download %s in original format" arg1=$theme.sourceImage.itemTypeName.1}
</a>
</div>
{/if}

{* Show any other photo blocks (comments, exif etc) *}
{foreach from=$theme.params.photoBlocks item=block}
{if $block.0 == 'exif.ExifInfo'}
<div id="exif" class="gcPopupBackground" style="position:absolute; left:0px; top:0px; padding:5px; visibility:hidden;">
<table cellspacing="0" cellpadding="0">
<tr>
<td style="padding-left:5px;">
<h2>Exif</h2>
</td>
<td align="right">
<div class="buttonClose"><a href="javascript:void(0);" onclick="toggleExif('photo','exif'); return false;" title="Close"></a></div>
</td>
</tr>
<tr>
<td colspan="2" class="gcBackground2" style="padding-bottom:5px;">
{g->block type=$block.0 params=$block.1}
</td>
</tr>
</table>
</div>
{else}
{g->block type=$block.0 params=$block.1}
{/if}
{/foreach}

{* g->block type="core.GuestPreview" class="gbBlock" *}

{* Our emergency edit link, if the user all blocks containing edit links *}
{g->block type="core.EmergencyEditItemLink" class="gbBlock"
checkSidebarBlocks=true
checkPhotoBlocks=true}
</div>
</td>
</tr>
</table>

thanks
Kobi

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-12-12 09:56

have you tried the downloadlink module, from the community repository?

 
kobitriki

Joined: 2008-10-29
Posts: 21
Posted: Fri, 2008-12-12 10:45

Hi Alecmyers,

Yes, i tried this module, but couldnt set it right.
I wasnt able to hide the line "download.." under the thumbs in albums, and couldnt place an icon in the photo page.
if you know how to do it please let me know,

Kobi

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2008-12-12 14:05
	<div class="gbBlock">
	  <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}">
	    <img src="http://mysite.com/images/my_cool_download_icon.png" height="30" width="30" title="{g->text text="Download %s in original format" arg1=$theme.sourceImage.itemTypeName.1}" />
	  </a>
	</div>

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

 
kobitriki

Joined: 2008-10-29
Posts: 21
Posted: Mon, 2008-12-15 10:36

Hi Suprsidr

I add the code to the photo.tpl, but when i use it it opens the image in full size instead of displaying
"Save As.." window, how can i modify the code to do so?

Thanks
Kobi

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2008-12-15 12:05

You cannot without redirecting to another page with a serverside script to create a stream.
http://www.google.com/search?sourceid=gmail&q=force%20download%20instead%20of%20image%20view

Much simpler to add "Right-click and Save as" text.
OR
Use one of the cart modules (zip?)

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

 
kobitriki

Joined: 2008-10-29
Posts: 21
Posted: Mon, 2008-12-15 12:16

problem solve by Downloadlink module.

thnaks all.