Hi. I'm trying to add a download link to the current image, ie. the image being viewed. I tried inserting the following line into my theme's image.php but it appears to download a link and not a jpeg image as I'm expecting.
<?php printdownloadLink($_zp_current_image->getFullImageURL()) ?>
Also, how can I modify this to print the word 'download' instead of the image name? Thank you!
What I'd like to do is have a 'Download' button that will download the current image.
Comments
The function will output an href. But you can turn that into a button by appropriate CSS. E.g. add a `... around the function call output and in your CSS define the css for`mybutton`. A good starting point would be the`buttons` css class in one of the distributed themes.
printDownloadLink(path-to-file);.
What parameter can I use for 'path-to-file' that will pass the current image to the function and produce a jpeg image?
http://www.zenphoto.org/documentation/plugins/tools/_zp-extensions---downloadList.php.html#functionprintDownloadLink As you did it will get the full image.
<?php printdownloadLink($_zp_current_image->getFullImageURL()) ?>
is producing:
Warning: filesize() [function.filesize]: stat failed for /photography/albums/all/avocado_awesomeness.jpg in /home/user/public_html/photography/zp-core/zp-extensions/downloadList.php on line 496
avocado_awesomeness.jpg (0 Bytes) - 0 downloads
The line:
<?php printdownloadLink(getFullImageURL()) ?>
is producing:
photography (4 kB) - 3 downloads
When I click this link a blank unknown document is downloaded, not a photo.
What else can I try? Thank you.
As to the 2nd you should also look into your server error log.
<?php printdownloadLink(getFullImage()) ?>
is producing:
Fatal error: Call to undefined function getFullImage() in /home/user/public_html/photography/themes/zpmasonry/image.php on line 69
What else?
`$_zp_current_image->getFullImage()` (object model way)
OR
`getFullImageURL()` (template function way - if you use this be sure not to protect the full image url - use getUnprotectedImageURL() in that case)
gets the url to the full image in single image context.
<?php printdownloadLink($_zp_current_image->getFullImage() ) ?>
<?php printdownloadLink(getFullImageURL()) ?>
<?php printdownloadLink(getUnprotectedImageURL() ) ?>