hi,
i'm looking for a tip on how to have a button or icon
next to the images in the album, that let (stupid) users
download the high or midres image.
believe me, there are a lot of people out there that
dont know rightclick/save as and cant understand
that difficult concept.
thanks, marco
Powered by Gallery v1.4.4-pl4
------------------------------------------
Posts: 27300
Save this as download.php and put in your gallery directory.
then save this as /html_wrap/inline_photo.frame
It will place a link under the photo to download the full image.
Let me know if it works as I only tested it on my 1.5B system.
Dave
Posts: 3
yay! success : )
small change: saved the .frame file as .frame.default, and it works great on
1.44 hosted at opensourcehost.com
dave, dankeschoen from germany
Posts: 3236
You probably don't want to use the ".default" extension, unless for some reason the other didn't work? If you ever update gallery you will be wondering why your modification got borked
You should copy the something.default to just something. Sorry, in edit mode and I can't see the actual filename. You should end up with two files, and gallery only uses the ".default" one if it can't find the other.
Posts: 3
yupp, that's correct.
xxx.frame <--this one is modified
xxx.frame.default . <--not modified.
if anyone wants to look> http://www.mmacm.info/gallery/, its a website for a photographer.
thanks, marco
Posts: 10
this mod works fine and great if gallery is standalone.
so i get a download link looking like
http://www.gelitin.net/gallery/download.php?filename=stoll.jpg
so this link works!
but i have gallery integrated into Mambvo 4.5.2
then i following download link is generated
http://www.gelitin.net/mambo/index.php?filename=rabbit_total.jpg&option=com_gallery&Itemid=28&include=download.php
this link does not work. the image seems to be corrupted...
any solutions for this?
is it possible to change code of download.php to make it working in Mambo?
Posts: 27300
I can't test but you should be able to edit this line:
echo "\n<a href=\"" . makeGalleryUrl("download.php", array("filename" => $fileName)) . '">['. _("download this item") ."]</a>\n";
to something likeecho "\n<a href=\"http://YOUESITE.COM/gallery/download.php&filename=" . $fileName .">download this item"</a>\n";
Posts: 10
Thanks for the hint...
i changed your suggestion to
Now it works.
Great!
Posts: 2
Hi
This work with Gallery 2?
Thank you
Posts: 10
hi, i've just tried this on my gallery which is v.1.5.4.
It works great on mozilla firefox when either using the download and open option or the download and save.
But on IE6 after using the 'open' option and after downloading i get a message saying that real player cant find the file, its looking in my temporary internet folders for it, but nothing can be found that matches the file name.
is there something in the code that i should be changing?
or is it something to do with my internet dowload settings for IE?
any help would be great.. thanks
http://getoffmeyoubummer.dreamhosters.com/gallery
Posts: 1
Can some kind soul provide the same kind of information for Gallery 2?
Posts: 10
I successfully used the download.php script mentioned in this thread...
Now since the server (Apache/1.3.33 (Darwin) PHP/5.2.1) changed its PHP to 5.2.1
using Entropy.ch PHP5-Package the script does not work...
clicking the download link so far downloaded the requested image.
now it downloads an empty file with the name of the Album...
looks like a path problem...
what to do?
and yes i would like to stay with PHP5
and the download.php (download whole album as Zip archive) from
gallery 1.5.6 is working properly. Is it possible to change this script to download single files, not the whole Album?
Posts: 10
solved the problem myself.
in file download.php i had to change
$filename = $HTTP_GET_VARS['filename']; to
$filename = $_GET['filename'];
because of PHP 5.2.1
and changed in my .htaccess file and in php_value.template
<IfModule mod_php4.c> to
<IfModule mod_php5.c>
Posts: 5
For Gallery 2:
In modules/core/templates/blocks/PhotoSizes.tpl (for example):
{assign var=foo value=$theme.imageViews[$theme.imageViewsIndex].id}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=$foo" arg3="dl=1"}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}
</a>
In modules/core/DownloadItem.inc:
Find this line:
$requestMethod = strtolower(GalleryUtilities::getServerVar('REQUEST_METHOD'));
And add / change the following lines as follows:
$dl = (int) GalleryUtilities::getRequestVariables('dl');
$phpVm->header('Content-type: ' . ($dl?'application/octet-stream':$data['mimeType']));
$phpVm->header('Content-Disposition: '.($dl?'attachment':'inline').'; filename="' . $data['pseudoFileName'] . '
$stats = $platform->stat($data['derivativePath']);
$phpVm->header('Last-Modified: ' . GalleryUtilities::getHttpDate($stats[9]));
$phpVm->header('Expires: ' . GalleryUtilities::getHttpDate(time() + 31536000));
(Most of the credits go to jmullan from #gallery on irc.freenode.net)
Posts: 1
I'm also looking to add a download button to by gallery 2.
I used the instructions from above by adding
{assign var=foo value=$theme.imageViews[$theme.imageViewsIndex].id}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=$foo" arg3="dl=1"}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}
</a>
to -> modules/core/templates/blocks/PhotoSizes.tp
which added the download button.
but for the second part i swaped some of the the code in modules/core/DownloadItem.inc with
$dl = (int) GalleryUtilities::getRequestVariables('dl');
$phpVm->header('Content-type: ' . ($dl?'application/octet-stream':$data['mimeType']));
$phpVm->header('Content-Disposition: '.($dl?'attachment':'inline').'; filename="' . $data['pseudoFileName'] . '
$stats = $platform->stat($data['derivativePath']);
$phpVm->header('Last-Modified: ' . GalleryUtilities::getHttpDate($stats[9]));
$phpVm->header('Expires: ' . GalleryUtilities::getHttpDate(time() + 31536000));
as discribed but this causes my thumbnails to go missing and doesn't allow me to download the images any way. Is there any who got these instructions to work?
Posts: 10
Anyone get any of this code working stable with 2.1?
Posts: 1
I managed to get this working for gallery2 as follows:
I used this as above to add the Download link in modules/core/templates/blocks/PhotoSizes.tpl:
{assign var=foo value=$theme.imageViews[$theme.imageViewsIndex].id}
<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=$foo" arg3="dl=1"}">
{g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1}
</a>
and then in modules/core/classes/Gallery.class I changed the following line:
header('Content-Disposition: inline; filename="' . $filename . '"');
to:
header('Content-Disposition: attachment; filename="' . $filename . '"');
and it worked perfectly.