Feature request: Inline browsing of attachments instead of downloads
Virtual Research Environment / On-line Bibliography Manager
Brought to you by:
sirfragalot
Hi,
most of the time, I only want to have a quick look at an attachment in the browser, instead of downloading it immediately, thereby cluttering up the Downloads folder and eventually being forced to open the folder and deleting the file. Both Chromium based browsers and Firefox are doing the latter. AFAIK this could be remedied at the server side. Would this be implying much work? It would give the WIKINDX users more freedom to download attachments only if they deem this as worthwile.
Best
Joachim
Will look into it Joachim,
Mark
We can do it, this is a trivial change.
Was thinking of a DIV like:
https://stackoverflow.com/questions/2740297/display-adobe-pdf-inside-a-div
This would open in the same tab and we could then add navigation buttons above the div to return to the resource or to download the file.
Something for me to do?
Mark
I was thinking of changing the header's value from "Content-Disposition" to inline and keeping it opening in a blank page. Sometimes iframes are blocked.
I was thinking of this answer:
Doing it inline would not allow anything else in the tab/window and I think it's more logical to keep it in a wikindx window with all the usual navigation (back to resource etc.) or choose something from the menu (instead of having to close the tab/window). Would doing it like this be a problem?
Mark
It is also an original solution. Why not. We need to test. This probably requires some PHP/JS code to handle extending/folding the div, handle multiple attachments in a single div, not cause preloading, and only do this for documents supported in browser previews.
I'll give it a go (but I wasn't thinking of something so complicated). I'll do something then you could have a look at it.
Mark
I look forward to seeing what you come up with.
I currently have this.
Anyway to find the browser width and height in PHP? (need to set width and height in the object element else the preview is very small.
Mark
. . . not all mime types are supported (e.g. an XLSX file).
Yes because the rendering is done by the browser and not delegated to an other software txt, html, pdf, ps should be supported.
Hi Joachim,
Something like this acceptable?
Mark
Hi Joachim,
It's now in SVN if you wish to check on a non-production server and give some feedback.
Mark
I committed a fix. You cannot access directly an attachment because there are stored without file extension. Without extension the server doesn't send the file with the right mimetype. This is emulated by downloadAttachment(). In addition it is better for security because we can add authorizations a posteriori.
Looks great, I installed it on my server. But inspite of the module in place (I even restarted the web server) this is what Firefox did when clicking on an attachment – downloading it right away (as did Vivaldi, a Chromium based browser) …
Any luck yet Joachim?
HI Joachim,
I've tested it on Firefox, Chrome, Opera, and Safari. Some minor differences in how each displays but otherwise fine.
When you are in resource view (or viewing only attachments in Advanced search), to see the preview, you must click on the attachment icon, not the attachment's file name (that downloads).
Did you click on the icon?
Mark
Last edit: Mark Grimshaw 2023-02-13
Yes, I clicked the icon, same result as before. You can check yourself on my production server, where I replaced ATTACHMENTS.php with the new one. Maybe it only works in a complete SVN installation?
Related
Bugs and feature requests : #523
Ah! I think that explains it. There were several files changed in order to do the rpeviewing, not just the one. You will need the whole SVN but do test on a non-production server.
Mark