How about [mla_gallery list=mask]?
-
The [mla_gallery] Shortcode’s List parameter can be many things, but eventually all of them lead to the real URL, especially when dealing with documents.
Sure, there’s list=download, but that’s only good for pure downloads. I’m talking about cases when the user just opens the file in the browser, like in list=file/full.https://wordpress.org/plugins/wp-publication-archive/ is a plugin that died almost half a decade ago. But it had a nice feature which you can borrow due to being free and open sourced:
By default, both file opens and downloads are streamed to your server. This means the plugin will attempt to open the file…and will stream the contents of the file to the browser. This has the advantage of never exposing the raw download URL to the user.
Will you consider doing the same when using something like list=mask?
Although if you do, keep in mind to add a different treatment for large files:
Unfortunately, it means your server has to download the file first before it can pass it along to the user. For smaller files, this isn’t an issue. But for much larger files, connections can time out.
If you are serving large files, you can force the file open URL to forward connections rather than stream them. This means requests to your file open URL (i.e. http://site.com/publication/title/wppa_open) will receive a 303 “See Other” redirect pointing them to the original resource. It’s less work for your server, but the end user will see the original URL.
The file download URL will behave the exact same way – redirecting requests to the original resource rather than streaming the file to the browser. Unfortunately, this leaves the exact behavior of the link up to the browser – some will attempt to download the file, some will open it instead.
-
Thanks for your suggestion and the link to the WP Publication Archive plugin.
I will look into this when I have some time to play with the plugin you found and think about how it fits with MLA. I will leave this topic unresolved for now and post an update when I have progress to report.
Thanks for your patience in awaiting my progress report. I have finally had a bit of time to look into your suggestion.
I downloaded and installed the WP Publication Archive plugin. I created a “publication” for a PDF file and looked at the corresponding single publication page, which lists the document title, file name and links for “view” and “download”.
The “download” link behaves just like the MLA
link=downloadparameter, which you referred to as a “pure download”. The “view” link is the new behavior you are after; is that right? It seems to behave just like the MLAlink=fileparameter; is that right?The difference, as you suggest, is that the URLs associated with the “download” and “view” links do not show the actual URL of the file; they are the “pretty permalink” of the publication.
So, what you are suggesting is something like a new MLA
link=streamparameter that would behave just likelink=filebut would hide the URL; is that right?For this new parameter, I imagine the URL associated with each gallery item would contain the ID value of the Media Library item associated with the desired file. It would look something like:
http://www.mysite.com/wp-content/plugins/media-library-assistant/includes/mla-file-downloader.php?mla_download_id=5394Would that be acceptable? If so, this is not too hard to implement. If you can confirm that I have understood what you want I can investigate further.
I guess that is it. Like you said, the visual link should be the “pretty permalink”.
But due to the aforementioned issue with large files, it should be named link=mask and not link=steam.BTW, note in their case they also do it for downloads. In that case link= will remain the same, but will be joined with a new mask=true/false parameter.
Thanks for your update. After some additional thought I arrived at a somewhat simpler URL format, e.g.:
http://www.mysite.com/wp-admin/admin-ajax.php?action=mla_transfer&mla_item=my-item-slugThis is less “pretty” than the URLs generated by the WP Publication Archive plugin, e.g:
http://www.mysite.com/publication/view/my-item-slug http://www.mysite.com/publication/download/my-item-slugThose work because “publication” is registered as a custom post type, which is significantly more complex than the approach I am planning. I hope the difference in URL format will be acceptable for your application.
I am undecided about handling the “issue with large files“. How large are the files in your application?
I do plan to support both “view” and “download” but I haven’t decided on what parameter names and values to use for them yet; perhaps
link=fileorlink=downloadwith a separatemask_url=true.By the way, I never saw a response in your other support topic:
Create a feed out of the media library
Did you ever get a chance to try the new example plugin I developed for the latest MLA version?
I’m thinking about posting PDF files, which will look a lot more professional using the complex approach. Maybe you can start with the simple approach and only use a complex one later.
As for large files, my PDF files are probably 1M-10M. I don’t know what constitutes a “large” file. I just shared the information, so you’ll know in advance about this issue that someone else already discovered.
I truly apologize for not reacting in the other topic. I’m short on time, and the required testing involves many steps. Initially it took installing a beta and eventually researching an add-on plugin. I saw another user join in the discussion and hoped you’ll be able to test it together. Can you see why it didn’t work for that user?
Thanks for the additional details. I would guess that “large files” means something like 50M or 100M. I doubt very much that 10M would be a problem for a streaming application.
I am still investigating the “simple” and “more complex” alternatives for this feature. You wrote “I’m thinking about posting PDF files, which will look a lot more professional using the complex approach.” What do you mean by “look a lot more professional“? I ask because:
- The only difference will be in the format of the URL. The gallery display will be the same in all cases.
- The “more complex” “pretty permalink” solution might be better for Search Engine Optimization. Is that a concern?
- Both approaches hide the actual location of the file on your server. Is that a concern?
I realize that this feature has two separate parts:
- How the link is formatted.
- How the file is transferred.
Which of those two is more important for you, and why?
Thank you for your help in thinking through this feature!
Regarding the RSS feed topic, I had a good dialog with the other user, who has a rather specialized application. They ultimately decided that understanding how to use RSS was a barrier for their audience and did not add it to their site. The example plugin is now in the official MLA release, so installing a beta is n longer required. If you ever get back to trying the example plugin I welcome your feedback on it.
I think both things are important. I want to post pretty links – good for the eye and for SEO – and at the same time I don’t want to expose the actual links.
If I had to choose, I’d go with protecting the links. It just feels like it gives the admin more control and doesn’t expose files and folders on the server. It might even reduce the chance for hotlinking.
I have uploaded a new MLA Development Version dated 20171113 that contains a new
mla_named_transfer=trueparameter for[mla_gallery]that generates theadmin-ajaxlinks described in my earlier post. You can find more information about the parameter in the “Transfer by Item Name” section of the Settings/Media Library Assistant Documentation tab. The new Development Version also contains the initial version of the “MLA Item Transfer Pretty Links” example plugin. It would be a great help if you can install the Development Version and example plugin and do some testing of your own.The
mla_named_transfer=trueparameter implements the “simple” approach described above. The new example plugin adds the “more complex” alternative, transforming the links from theadmin-ajaxformat to something like:http://www.mysite.com/mla-transfer/view/my-item-slug http://www.mysite.com/mla-transfer/download/my-item-slugThe example plugin adds a Settings/MLA Pretty Links page that allows you to change the “mla-transfer”, “download” and “view” portions of the pretty links. It will transform any
[mla_gallery]shortcode containing amla_named_transfer=trueparameter.To get the Development Version, follow the instructions in this earlier post:
Create a feed out of the media library
To install the example plugin, navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. You will see a table that lists all the example plugins and gives you a “one-click” action for installing them. Type “pretty” in the text box and click “Search Plugins” to filter the table. You are looking for the “MLA Item Transfer Pretty Links” example plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate it as you would any other plugin.
Thanks for inspiring these MLA enhancements. I look forward to your feedback.
I have released MLA v2.64, which contains the example plugin developed for this topic.
I am marking the topic resolved, but please update it if you have any problems or further questions regarding the example plugin or the
mla_named_transferfeature it uses.
The topic ‘How about [mla_gallery list=mask]?’ is closed to new replies.