download image from easy-fancybox-pro

Your Account / Forums / Easy FancyBox Pro / download image from easy-fancybox-pro


  • Author
    • April 18, 2016 at 9:16 am #6358

      I would like to have an option to download the image that my customer sees.
      Is there a way to download the original image from within fancybox lightbox?
      Or can I show a download link?
      Thanks in advance,

    • April 18, 2016 at 9:16 am #6359

      Hi Benjamin,

      Sorry, no. There is no such option.

      To get it working, you’d have to do some fancy stuff like this:

      1. Add a rule to your .htaccess file like this to force URLs with “.jpg?view=download” to download the image instead of showing it in a browser window:

      RewriteCond %{QUERY_STRING} ^view=download$
      RewriteRule .*\.jpg$ - [L,T=applicaton/octet-stream]

      2. Open to edit posts in the Text view tab and manually add a button to each image alt attribute like this (for example):

      <form method='get' action=''><input type='hidden' name='view' value='download' /><button type='submit'>Download!</button></form>

      Note that all < and > signs must be respectively changed to & lt; and & gt; (without the space between the & and the rest) when inside the alt attribute to not break the img tag. The URL used in the action attribute must match the download size image URL.

      If you use image galleries on your pages, then you’ll need to go to your WorPress Media Library open each image for editing and enter this snippet in the Alt field. This time you can leave the < and > signs as they are because WordPress will escape them automatically.

      Like I said, not easy, but should be possible.

  • You must be logged in to reply to this topic.