-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow loading larger preview or full-sized images in image viewer #578
Comments
This comment has been minimized.
This comment has been minimized.
A long time ago this feature was already discussed (nextcloud/gallery#38). |
This comment has been minimized.
This comment has been minimized.
cc @skjnldsv Is the ability to direct download a image when going through the slideshow viewer or the photos app an overlooked feature or is it not possible to implement in nextcloud for some reason? Have to agree with @darmbrust that browsing thousands of images over the slideshow or photos app and then having to hunt them down in the file listing or share them for a direct download link is painful. Why isn't there a direct download option? |
Because we need a proper fileActions API so we can implement the file actions into viewer. Hardcoding actions is something I don't want to do.
Because downloading a 22MB jpeg makes no sense when you want to preview a picture. |
This comment has been minimized.
This comment has been minimized.
Thanks! So it is a technical issue. It's not a big deal then. I just wish it was easier to direct download images on those applications. Well, you're not wrong about the 22MB JPEG. But I think it's a waste to generate preview images on large albums if the nextcloud instance is on a LAN setup with no bandwidth limitation. But that's personal preference. Thumbnails would still have to be generated regardless. Appreciate the response! 👍 |
This comment has been minimized.
This comment has been minimized.
You already mention mobile... And I share my photos with family, so the slow upload I have as private user is a huge bottleneck. Google and such have way stronger bandwidth than most private users - and thus I'd rather argue the absolute opposite of you: Nextcloud should be MORE frugal with bandwidth as the upload speeds of most home networks is tiny compared to data center solutions. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Well, mr @darmbrust if you want something else than what we are building, you can modify it. But We make Nextcloud for everyone, not just for you. Please change your tone a bit, as this is not constructive at all and you are a guest here. In any case, from my side on this issue - the mobile apps I believe use the preview and then download the full image when you start to zoom in, the previous Gallery I think did something similar, so I think we could consider doing that, too. Perhaps then we could even consider making the default preview smaller (like, 2000x2000 pixels or even 1000x1000) because the full image will be there soon enough. I'm not sure how urgent this is, though, but perhaps if somebody wants to work on this @skjnldsv would be willing to review and merge it. |
Well, we just need to do it automatically, and adjust to serve what is proper for the screen size of whichever device is connected. No matter if someone is browsing Photos from a small smartphone or a 4k screen, it should display the photo in the appropriate size. Of course initially it can be a bit pixelated, while it loads the more proper resolution photo. Additionally, as @jospoortvliet said:
For the download action, see the separate issue at #88 |
That still makes assumptions about what the user is doing with the photo. If I upload a super hi-res photo to nextcloud, it shouldn't (only) assume that I only want to view it at the resolution of the screen I've put the browser in. There should be a way to get the native photo, with no resizing. A download button is part of that, but not all of it - because that takes me to a file prompt (one usecase). The other use case, is to just give me the full res photo, whatever it is, in the browser, so I can zoom in on details in a non-pixelated version, without jumping through hoops. Ideally, a user could set that "full res" option once, and it would be honored as you continue browsing, because now, the server could stop wasting cycles resizing images - just do thumbnails, and full res. In my use case, on a local network, it would be far better performing that what I see now, with nextcloud spending tons of time generating previews, and then doing it again when I move the browser to a larger monitor because I want to see the image at a non-pixelated resolution. The old photos app did have a download button, but at least in the last versions of it, it was very confusing, because while it gave you a download, and used the native files name when it provided the file, it didn't actually serve the native file - it served a (much smaller) resized version. That is definitely not what I expect "download" to mean in the context of a file. It appears that in the current Photos app, if one clicks on "View Image" in the browser (Firefox in my case) it prompts me to save the file - which is not what I would expect. I'd expect that behavior to be in a download button - and if I right click and say view image, the server would send the proper metadata so that the browser just showed the photo directly as an image, instead of prompting to save it. |
This is exactly what will be solved by
How and when exactly that downloading of the full image is to be done can be optimized as well. E.g. already preload when you start zooming just the slightest bit etc. Bottom line: Can all be automated, doesn’t need any setting.
As said: For the download action, see the separate issue at #88
Good point. Mind opening a separate issue about that? Thanks. |
Part of the problem is that Nextcloud's way of generating the thumbnails (GD) is slow. It would be awesome to see libjpeg-turbo (or a different more efficient library) implemented. (oops, that's in a different repo, so maybe it doesn't really fit here) |
Is there currently a feature request opened for that? I've seen it mentioned, but didn't track if there was a specific tracker for it. Though I still think it would be nice to have an option to not generate the (larger) scaled image at all. In local deployments like mine, the time cost of generating scaled images is greater than just sending the larger file. My client computer has far more horsepower than my webserver, so it can do the scaling far faster on the client...
sure :) - #579 |
My issue with the lack of ability to download the original image is that I have my previews set to a low quality to save space. I can find the location and go through the file listing to download it but that takes a lot of time and it's frustrating for me. Perhaps as a compromise there could be a button to open the correct folder to where the image is located? This would be extremely useful in the photos app as there is no way to tell what folder a image is in on the default page other then a tiny URL when hovering over it on the bottom of your screen. Which IMO most of my family and regular people won't understand. Alternatively we could use something other then GD or ImageMagick to generate previews. Something like @kostaldavid8 suggested. I understand there are security issues that would need to be worked around but somehow google photos can create high quality JPEG images with minimal loss of quality with very small filesizes. |
You can enable imagick and it will be faster btw Closing now, #579 have its own issue and is closed. We also optimized the loading and rendering of photos for 21. |
Slightly off-topic:
I know this is closed, but I've already had this debate on both the support forums and reddit; I use Flow to launch a script whenever an image is uploaded. This script calls Given the above, it makes no sense to me that I have to choose between
I understand you don't want to add options everywhere, but this hard either-or choice is banal in my eyes. I don't mind the preview image getting generated, I just don't want it to be shown to the end user. (I understand it is used as a source image for thumbnail generation? Though I don't see why they couldn't be generated from the original file.) |
@skjnldsv, why is this issue closed if it has not been fixed? |
From what I can see, the maintainers of the image apps in nextcloud have a very small view of the use cases for images in nextcloud, and they refuse to introduce anything that is outside of their usecase. Combine that with replacing the image viewer every 3 or 4 years with a new one that is missing half of the features the old one had, and we get where we are today. The unfortunate reality of opensource projects. The authors of the new viewer in nextcloud 18, I'm sure, did a lot of work, and made a lot of improvements for their use cases. But then, rather than introducing it as an optional (unfinished) beta photo viewer to try out, and get feedback, as the future replacement for the existing viewer.... they just put it in as the new viewer in 18. And they didn't release the old one as compatible with 18. As soon as people upgraded to 18, with any sort of variety of use cases, everyone was pissed at them, because they broke the world in about 10 different ways that they hadn't even thought of or tested for. "Fixes" for the worst of the ways they broke the world trickled in over the next year... but some things, like this issue, still aren't resolved. And everyone on both sides is upset, because the users that had all of their usecases broken are upset with the developers, and the developers are upset that it appears people don't appreciate their work to maintain the app. So, we still have an image viewer that can't even do the basic function of allowing you to download the original file. (Which is maybe finally fixed in the most recent release of 21, according to the change logs)... And it is incredibly slow, because it wastes resources trying to convert pictures on request to who-knows how many sizes, rather than having the ability to just serve the file. In my use case, everything would perform better if I simply had thumbnails for the grid view, and native images. But I've been informed, repeatedly, that my use case isn't valid. They also seem to hold the religious opinion that any option is too hard for an administrator to understand, so options to configure the behavior for your deployment are verboten. But yet, a complicated, error prone, broken tool like the thumbnail generator add on is the way to go, to attempt to fix the issue. Which in practice, doesn't really work any more. At least, not for doing anything other that wasting more disk space. I'm sure this reply will be marked as off topic as well. But the the only real solution I see is to build a new photo viewer with different maintainers, unfortunately. This history of this thread, and the way 18 was rolled out speak for themselves. Personally, I'd like to see the photo app feature of nextcloud simply "outsource" to something like https://github.com/photoprism/photoprism No idea on the feasibility of something like that. |
This issue has been driving me crazy for a while now, finally got around to fixing it. Make sure only one size (256x256) of previews are generated and used: $width = 256;//$specification['width'] ?? -1;
$height = 256;//$specification['height'] ?? -1; can be patched in place in Make the viewer display the full resolution image instead of a preview: viewer/src/mixins/PreviewUrl.js Line 74 in ff759ac
if (hasPreview && !hasPreview) { You have to build the viewer ( Would the nextcloud developers appreciate a pull request for this, configurable with three variables? Edit: needs two more files edited (no recompile) to work properly on public shares too: // $f = $this->previewManager->getPreview($node, -1, -1, false);
$response = new FileDisplayResponse($node, Http::STATUS_OK, ['Content-Type' => $node->getMimeType()]); // img.attr('src', OC.generateUrl('/apps/files_sharing/publicpreview/' + token + '?' + OC.buildQueryString(params)));
img.attr('src', $('#previewURL').val()); |
@BotoX what does this do to the user experience? And how to do this?
|
What do you mean? You see originals instead of previews now when opening images.
https://github.com/nextcloud/viewer#-development-setup Here's an example album from my nextcloud: |
Thank you so much @BotoX for sharing this! I host nextcloud on a RPi on my local network and was looking for an alternative to nextcloud because of the impossible tradeoff between browsing thumbnails and loading the full image in the viewer. I don't use public sharing so just modifying It would be great to re-open this issue and have this as an option in nextcloud 🚀 |
Would it be hard to make a button in the upper right corner of the photo viewer that allows the user to toggle between full size image and preview image? I'm no coder so just asking. |
A bit confused here, reads to me as
I think we can have this simpler (hacky, as in strictly fetching full image)
What would be sweet is some flag that gets checked before the The flag "showFullSize" being set by the user will have to be persisted. Adding to what @laurensbl suggested. Otherwise the user logging in the next time will have to flip the switch again.
An even sweeter stuff will be "showFullSizeIfLT = x kb" that each user maintains (with an admin hammer of max x kb [to help metered networks]), will fetch unmolested full size images if size is less than x KB. PS - php and JS are the languages that I've never touched :/ . I wish I could help here but it will be a few weeks before I can get familiar with them |
Summary for the feature "toggle original image":
Would that be an idea? (Why I want this: Save space on the disk with preview_max_x/y + low hardware performance.) |
I would too love a way to be able to zoom into pictures without having to download them first. Another option I see instead of a user toggle:
Advantages would be that a user is still able to quickly skip through big photos and does not need to understand the usage of a switch. |
I second this. IMHO a small preview config is a legitimate use case where the viewer is not usable. Completely deactivating previews so that the viewer loads the original image is not a solution, since it's not possible to see which image it is in the overview. Inspired from @BotoX s comment I wrote a little patch script that can be executed automatically after nextcloud updates (as long as these lines aren't changed). sed -i "s/img\.attr('src', OC\.generateUrl('\/apps\/files_sharing\/publicpreview\/' + token + '?' + OC\.buildQueryString(params)));/img.attr('src', \$('#previewURL').val());/g" /var/www/html/apps/files_sharing/js/public.js
sed -i 's/new FileDisplayResponse($f/new FileDisplayResponse($node/g' /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php
sed -i 's/getPreviewIfAny:function(e){var/getPreviewIfAny:function(e){return e.devPath;var/g' /var/www/html/apps/viewer/js/viewer-main.js
|
@timdah any fix for nextcloud 29+? Thanks |
@BotoX I found this issue as I was searching solution for the very same issue that you were facing: Too many and too big previews. Rather have small preview files and have nextcloud show the original when requesting files larger than the max preview size. Though I'm definately not a developer, I installed npm + stuff, cloned stuff from git and went by the instructions on modifying the source and building the stuff. Got something out of that, but not having the deep knowledge of developing things, nothing functional came out. Ie. modified the code, built the stuff, replaced viewer-init.mjs and viewer-main.mjs with new versions. That just resulted to files not being shown but instead sent as attachment (ie. browser file save dialog opens) :( Me and most likely many others too would appreciate it a lot if you can make available an updated version (for nextcloud 30.x) of the viewer which functions like the one you have on your own setup. Ps. I can't understand why NC (as product) insists on showing the previews and not having option to show small previews and larger originals. the preview generation kills my system and eats all available filespace. |
@nenatap I've since switched to immich for photos. Upgraded to NC 30 today and applied the patches by hand one final time. Here's a git diff file for the changes made on nextcloud 30.0.4-1 from the archlinux repo. Modified files: The change in FileDisplayResponse.php only makes sense with the following line in your nginx config:
Adjust the alias path obviously. |
Thank you. I'll have a go with the diff. I'll need to have a look at immich, looks nice. Perhaps I'll might modify my setup to have my media on Immich and leave other boring data (everything except photos and videos) in my nextcloud. Anyway, major thumbs up for your reply! few gallons of positive karma sent your way :) |
Additional comments after very tiny testing. For others: For those who are not that fluent with developing, here is how you can apply the change (at your own risk, take backups etc):
|
I have major problems with performance of image folders (external storage, on spinny drive). Loading thumbnails takes a lot of time or even, when there's a lot of pictures (>1000) in the folder, it completely overwhelms the CPU and RAM, rendering previews almost unusable. To improve this situation, I turned down preview size significantly and loading is a lot faster and actually usable now. The problem is that when you open that image, just the tiny thumbnail loads (and takes a long time to load as well, even though it's already generated).
I don't see a reason not to add an option to enable more tiers of thumbnails, with the larger one only being generated on demand, when the photo is opened. Or alternatively, a simple solution, just serving full-sized picture, as bandwidth is (at least for me), not a big concern on a computer.
Ideally, I would imagine small thumbnails generating in the background automatically, with larger previews generating as user opens the photos, which would be ideal in terms of speed as the server won't be overwhelmed by so many thumbnail requests, and disk space trade-off is small.
I know about https://github.com/rullzer/previewgenerator, but it's not a great solution as those large previews take up a ton of disk space, for nothing. And it didn't work for me, but that's a different issue. File loading is slow in general, at least in external storages, which is the only storage that fits my needs.
I am aware that this has been discussed already (#1968), but this issue is very old and without much interest.
The text was updated successfully, but these errors were encountered: