-
Notifications
You must be signed in to change notification settings - Fork 133
Website gallery replacement #611
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
base: master
Are you sure you want to change the base?
Conversation
This export module should replace the PhotoSwipe copy in darktable. See darktable-org/darktable#16205 for more details.
Currently JPG, TIFF, PNG and WebP are supported.
|
do you have a .zip or a static demo of an example gallery for this? |
Do you mean a ZIP archive with the Lua script and the static website parts (HTML, CSS, JS), or ZIP archive with an exported gallery? |
|
@scorpi11 can we make a separate job for the thumbnail generation? Currently the image export completes, then the progress bar just sits there while the thumbnails are generated. I think I did something similar in postsharpen.lua so I'll go look there and see how I did it. Can you make strings the user sees translatable? What happens if exiftool isn't available? There is a check_if_bin_exists() function in the dtutils file library. If it exists it returns the name and path (if windows) or it returns nil. It looks great and seems to work well. |
I already use check_if_bin_exists(). If it is not available, the script tries to calculate image with and height from the data it gets from darktable (maybe you remember that we discussed this on IRC and came to the conclusion that this is not that trivial). The calculation is in show_status(). |
I'll take a look, thanks. |
|
@wpferguson In your screenshot I notice that the symbol for fullscreen view is not available in the font that your browser uses. Maybe I should replace the symbols in the navigation bar by SVG icons to not depend on the available fonts. |
I looked through the code again and still didn't see it, so I dd a search and it popped right up. I guess I'm blind in one eye and can't see out of the other 😆 In postsharpen.lua I created a finalize function, sharpen(), and that's where I sharpened the images that were exported in the store function. |
an archive of the exported gallery |
|
A demo gallery is available here: https://tikei.de/~scorpi/demogallery/ |
I implemented a job to show the progress during thumbnail export. |
JavaScript files are now in js/, CSS files in css/, thumbnail images in thumbnails/.
27dfcc9 to
b0373f7
Compare
Done. |


Why?
This export module should replace the PhotoSwipe copy in darktable. It is unmaintained, lacks support for touch gestures and is difficult to extend, as the HTML part is generated by C code and the JavaScript part is more than 4000 lines of code.
See darktable-org/darktable#16205 for more details.
About this new gallery
The module is called "website gallery (new)" and needs to be enabled in the Lua script manager. It is written from scratch and does have nothing in common with the old PhotoSwipe variant.
I implemented all features that are present in the PhotoSwipe gallery:
The website code is designed to be usable on large displays with high resolutions as well as in small browser windows and on smartphone screens.
Keyboard navigation uses the space and arrow right keys to switch to the next image, as well as backspace and arrow left to switch to the previous image. The escape key can be used to leave the modal view.
On touchscreens, swipe left/swipe right gestures can be used to change the images in modal view.
Some technical stuff
I did not use any external components/libraries, as these often require npm or similar build tools. This would add a lot of complexity to the build process for a rather minor feature. My implementation does not require any build steps. The website only consists of static files, except for the image data generated during the export process (just a JavaScript array). The static JavaScript part is ~500 lines of code, compared to more than 4000 lines in the PhotoSwipe variant. Therefore, this new implementation should be much easier to extend with new features.
The Lua script can not request the actual dimensions of the exported image in a reliable way. Therefore it uses exiftool if available to get width and height of the exported image. If exiftool is not available, image dimensions might be off by some pixels. This only affects the frame of the thumbnails in the gallery view, which might show additional empty lines at the borders of the thumbnail image.
Outlook
This version is intended to provide the necessary technical features. The look and design are a first draft and might be subject to improvements. Translations are currently missing.
I have some future plans for additional features:
I want to let the user choose one of several visual styles in the GUI that are implemented in separate CSS files. The user could even create his own CSS styles which will be picked up at start.
Optical enhancements for the gallery and modal view would be nice. Patches from developers with better skills in web design are welcome.
Pinch-to-zoom using touch gestures could be added to the modal view.
The export script could add metadata about each image in the generated images.js which will be shown in modal view and/or in the gallery.
Navigation elements in the modal view could be changed to overlays that will only be shown after mouse/touch events.