download image from easy-fancybox-pro

Forums Easy FancyBox Pro download image from easy-fancybox-pro

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #6358
      Benjamin Wagner
      Participant

      Hi,
      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,
      Benjamin

    • #6359
      Rolf
      Keymaster

      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='http://your.site/wp-content/uploads/image.jpg'><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.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.