Offering downloads

Get help with installation and running PivotX 2.0.x here. Please do not post Extension or Theme related questions here.

Offering downloads

Postby RaVlaNa » Sun Feb 02, 2014 10:56 pm

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.
RaVlaNa
 
Posts: 81
Joined: Fri Jan 17, 2014 5:06 pm

Re: Offering downloads

Postby hansfn » Mon Feb 03, 2014 1:49 am

There is a download tag, but it is normally used for PDF, Word ... documents. Give it a try.
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Offering downloads

Postby RaVlaNa » Mon Feb 03, 2014 1:44 pm

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.
RaVlaNa
 
Posts: 81
Joined: Fri Jan 17, 2014 5:06 pm

Re: Offering downloads

Postby RaVlaNa » Thu Feb 06, 2014 3:01 pm

Any more clarification possible, please?
RaVlaNa
 
Posts: 81
Joined: Fri Jan 17, 2014 5:06 pm

Re: Offering downloads

Postby Harm10 » Thu Feb 06, 2014 5:59 pm

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?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Offering downloads

Postby hansfn » Thu Feb 06, 2014 6:28 pm

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
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Offering downloads

Postby RaVlaNa » Thu Feb 06, 2014 8:54 pm

OK Harm.
Thank you for that.
Should I enter that PHP code into insert_download.php?

Thank you.
RaVlaNa
 
Posts: 81
Joined: Fri Jan 17, 2014 5:06 pm

Re: Offering downloads

Postby hansfn » Thu Feb 06, 2014 9:05 pm

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.
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Offering downloads

Postby RaVlaNa » Thu Feb 06, 2014 9:45 pm

Oops, sorry Hans.
I misread.
Thought this was posted by Harm.
RaVlaNa
 
Posts: 81
Joined: Fri Jan 17, 2014 5:06 pm

Re: Offering downloads

Postby Harm10 » Thu Feb 06, 2014 11:02 pm

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/
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)


Return to 2.x Support Forum

Who is online

Users browsing this forum: No registered users and 7 guests

cron