download images

I am having trouble finding out how the downloadList.php plugin works.

On my image.php template I used:

`echo printDownloadLink(getUnprotectedImageUrl(), "download image");`

This gives me the link:
http://localhost/zenphoto/albums/surfing/_DSC7438.jpg.php?download=876

When I click on the link the I am just sending the ?download parameter, nothing downloads.
My PHP log reads:

`[31-Jan-2012 13:23:10] PHP Warning: filesize() [function.filesize]: stat failed for /zenphoto/albumshighres/albums/surfing/_DSC7438.jpg in /Applications/MAMP/htdocs/zenphoto/zp-core/zp-extensions/downloadList.php on line 283`

`[31-Jan-2012 13:23:10] PHP Warning: number_format() expects parameter 1 to be double, string given in /Applications/MAMP/htdocs/zenphoto/zp-core/zp-extensions/downloadList/downloadList-functions.php on line 155`

As you can see I have my images in the folder "albumshighres" (set in zenphoto.cfg) and with an "albums" album that acts like a wrapper.

Comments

  • acrylian Administrator, Developer
    The link generated is correct. Sadly I can reproduce that it does not work for images somehow. (We use it on our site as well, though not for images).

    Regarding the filesize() I am not sure but you can disable the option on the plugin options to workaround.
  • acrylian Administrator, Developer
    Ok, here it is, you need to use the path not the url actually:
    `<?php printDownloadLink('albums/'.$_zp_current_album->name.'/'.$_zp_current_image->filename, "download image"); ?>`
  • Thanks acrylian for the help.

    Yeah it looks like it only works with links to physical images, not once created from a script.
    Bummer as I was hoping to quickly implement a file dimensions option where the user could select the size to download or even with some javascript to detect screen resolution for a screensaver download.

    Any tip on how this could be done? Again I was hoping routing it with the Zenphoto image processor i.php although I am not sure if I can prevent people understanding the URL to download images without my watermark.
  • acrylian Administrator, Developer
    The plugin is meant for directly file downloads. However, the cached files (those sized via i.php) follow clear naming conventions you can implement (look at the files in cache). You only would need to change the path to "cache/<albumname>/<filename + size values>".

    To combine it with the downloadList plugin these images naturally need to be cached already though.
  • OK, so no custom dimension on the fly like a screensaver processed to fit the users screen, at least when it is not cached.
    So the download button needs to trigger a script to write the image in the cache, than download that image.
    Would love to take on this challenge later on.
    Cheers.
Sign In or Register to comment.