Page 1 of 1

Offering downloads

PostPosted: Sun Feb 02, 2014 10:56 pm
by RaVlaNa
I was wondering if there is some kind of function/extension that lets you allow visitors to download things (eg. images).
I know you can usually do it by right-clicking end selecting "Save as", but I want a simpler solution where people can click on a file/image or whatever to download it.

Is there anything that can be used for that purpose?

Thanks in advance.

Re: Offering downloads

PostPosted: Mon Feb 03, 2014 1:49 am
by hansfn
There is a download tag, but it is normally used for PDF, Word ... documents. Give it a try.

Re: Offering downloads

PostPosted: Mon Feb 03, 2014 1:44 pm
by RaVlaNa
Thank you, Hans.
It partly works when I use the "Insert PivotX download" from the menu in the editor, only:
[*]I cannot get the icon to display
[*]It does not really lead to a download, the image to be downloaded opens (in the same window) at full size, but the people would still have to right-click and select "Save image as".

Is there a way around this to display the icon, let clicking on it start a download, and not losing the page because the image opens in the same window?

Thanks in advance.
PS, it also looks like it is not possible to change the path when the window opens where you select a file.

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 3:01 pm
by RaVlaNa
Any more clarification possible, please?

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 5:59 pm
by Harm10
About the download buttons you can read http://www.remark-webdesign.nl/page/extra-lay-out-through-pivotx-buttons/remarkwebdesignen.
You will see that a download icon is shown (icon_image.gif is used from pivotx/pics for .jpg).
The download is executed but the browser then kicks in. If it is a known extension the image is shown like you would have selected 'Show image'.
Compare this behaviour with the pdf download (try the example on my demo page): the browser will also kick in if you have a pdf viewer installed.
As far as I know you cannot circumvent this behaviour except just use an extension that does not have browser behaviour attached to it (like the last download sample with extension .xyz).

If you use parm icon with value icon PivotX tries to find a suitable icon for you (see module_smarty around line 2325) based on the extension.

Does this help?

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 6:28 pm
by hansfn
It does not really lead to a download, the image to be downloaded opens (in the same window) at full size, but the people would still have to right-click and select "Save image as".

You are of course right. The download tag isn't intended for images. To make the browser download images in stead of displaying them you need to write a small script that sets "Content-Disposition: attachment" - see for example http://stackoverflow.com/questions/8875 ... attachment

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 8:54 pm
by RaVlaNa
OK Harm.
Thank you for that.
Should I enter that PHP code into insert_download.php?

Thank you.

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 9:05 pm
by hansfn
I'm not Harm, and you should not alter insert_download.php. If you don't understand what you should do, you better leave this - IMHO.

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 9:45 pm
by RaVlaNa
Oops, sorry Hans.
I misread.
Thought this was posted by Harm.

Re: Offering downloads

PostPosted: Thu Feb 06, 2014 11:02 pm
by Harm10
There are also some jQuery plugins available that offer rich download.
Short search gave this one http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/