I'm providing a patch which adds a "Download" link in the center of the item navigator, to allow users to get the full-size version of any uploaded photos.

Comments

siltaar’s picture

zengenuity’s picture

Status: Patch (to be ported) » Needs work

There should be an option in the admin interface somewhere to turn this off. Defaulted to off, actually.

siltaar’s picture

Sounds reasonable, will provide.

siltaar’s picture

Would you prefer a "one for all" switch in /admin/config/content/node-gallery/settings or a by-role right to see the Download link ?

The second option looks more flexible to me, but will display the Download link to the main Drupal admin.

I may work on a "download the full gallery" feature like in Picasa afterwards. Being able to actually share your photos is just needed on my point of view.

zengenuity’s picture

I don't think we really need a permission for this. My chief thing is that I don't want a future update to cause changes to people's existing galleries. That's why this should be optional and turned off by default. A global option is probably sufficient for this.

siltaar’s picture

So, bringing all together would be to add a global option which unlock a new permission.
I would have brought-by-Drupal level of access management, and you would have backward compatibility.

We might consider dropping the global option overhead while upgrading to Drupal 8…

zengenuity’s picture

I still don't think the permission is really all that necessary, but if you add it, make sure to add some instructions on the global enable/disable option to point people to the permission. Otherwise, people will turn it on and then be confused why it doesn't work.

siltaar’s picture

StatusFileSize
new7.09 KB

Done as soon as said (cof-cof…).

zengenuity’s picture

Status: Needs work » Needs review
zengenuity’s picture

Status: Needs review » Needs work

Thanks for your work on this patch. There are few issues with it before I can commit:

  1. Code Style: Please follow the Drupal code standards: https://www.drupal.org/coding-standards.
  2. Support for no media file: It's possible to have a node gallery without a media field specified. Imagine a gallery where people are posting Youtube embeds or something. It's possible. I think your node_gallery_api_get_cur_item_media() function is going to throw errors in that case. I didn't test it, but it assumes that $file exists when it gets the $file->uri.
  3. In node_gallery_api_get_item_navigator(), we shouldn't build the full sized image path unless this option has been turned on.
  4. Ideally, when you clicked Download, it should actually download rather than open in your browser. This is possible if you use a content disposition header, but it's a significant amount of extra work, because you won't be able to link directly to the file like you do now. You would have to build a menu route like node/%node/download and have that handle the header and passing the file through. I'll accept the patch without this change, but just throwing it out there for you to consider.
siltaar’s picture

Hi,

I will work on the 1sts points.

Regarding the 4th, the HTML5 download attribute of links may be used :
- https://developer.mozilla.org/fr/docs/Web/HTML/Element/a
- http://caniuse.com/#feat=download

But I'm personnally happy with the current behavior. I may add one more checkbox in the Other Settings panel to allow both behaviors, defaulting on the one you asked for.

siltaar’s picture

siltaar’s picture

siltaar’s picture

Status: Needs work » Needs review

Fixed points 1 to 3.

For point 4, I add an extra preference, linked to the main full sized image downloading preference.