Hoe grote aantallen AVIF-afbeeldingen in één bericht in te sluiten voor het online lezen van boeken?

Hello,
My project is to build a community focused on Tao Te Ching culture. I have over 5,000 ancient books that I need to display, and I have compressed all of them into the AVIF image format. Some of these books contain as many as 2,500 AVIF images.
My question is: How can I insert these images into a single Discourse post to enable my users to read them online?
I am looking for a solution, perhaps a plugin, that can provide the following features for users within a post:
Easily flip back and forth between images (like turning pages).
The ability to jump directly to a specific image number.
Crucially, images must be lazy-loaded; they should only load when the user navigates to them, not all at once when the post is opened.
My files are all organized in numerical order and are in AVIF format. Each book is contained within its own folder. The average image size is 150kb, and books typically have between 300 to 1,000 pages, with some exceptions reaching 2,500 pages.
Why do I have this requirement?
My collection of books is vast, currently exceeding 350GB. Compressing them to AVIF was necessary to manage storage.
Formats like AVIF and WebP are not easily packaged into a single PDF file.
Packaging the books as ZIP or RAR archives prevents online reading. Using e-book formats like CBZ would create too high a load on the server.
Thank you very much for your help!

I rarely say this, but I’m not sure that Discourse is a good tool for your problem.

If you want to anyway, I’d probably do something like create a topic per book and maybe a post per chapter, if that makes any sense (maybe there are no chapters?).

Then you could use an import script that would read the directory name and create a topic and then do something like

files.each do |f|
   u=uploader.create_upload(1, f.path, f.filename)
   raw += uploader.html_for_upload(u, f.filename)
end

And then you would use that raw to create a topic.

You’d need to look in the import scripts directory to find some examples of creating topics, but that’s a rough idea.

And that would then put all the images in a single topic/post. And then there are some tools that will let you scroll through a bunch up images, I think. Perhaps someone else has paid more attention to those than I have.

1 like

As was stated, Discourse probably isn’t helpful, at least with hosting your library. Instead, you might want to consider using a separate image hosting service alongside your Discourse instance.

Below is a list of self-hosted photo gallery services that might come with many features that you’d want: out of box web app, user and mobile friendly interface, directory based albums, search capabilities, etc.

You can run the image hosting service separately and use the URLs from it as embedded iframes on Discourse. This would keep your Discourse DB from having to download all the images, and let the image hosting service handle lazy loading. From there, you can start considering using theme components or plugins for standalone pages for the library, auto linking references from user posts, etc.

1 like

I don’t believe this is matter of hosting, but usability when reading. For more western stylish people this is very similar question than showing comics. And for that might find suitable platforms, but I’m quite positive that even WordPress can offer an solution.

And then connection of content and community/discussion by Discourse is totally trivial.

But in Discourse ecosystem something what Discpage offered, could be another solution. But it is broken.

2 likes

There are comic file format online reader available, which loads files on demand:
GitHub - codedread/kthoom: Comic Book Reader in the Browser for example supports alwaysOptimizedForStreaming=true which tells kthoom to render pages immediately as they are de-compressed and can load from URLs with range requests.

Would that also work if one wants to restrict access to books by user groups or for logged-in users only?

Thank you all so much for your help!
I’ve found a solution: I deployed a Zfile service on my server, which acts as a private cloud drive, and I have configured it to allow anonymous user access.
I can control the number of files displayed per page and customize how many are loaded manually each time. The permissions for anonymous visitors are set to “preview-only.”
This has solved several key challenges for me:
Complex File Management: It’s much more convenient to manage hundreds of thousands of images through a cloud drive interface.
On-Demand Previews: By default, the drive only lists the files, and a preview is generated only when a file is clicked. This works much like PhotoSwipe. (Although Zfile has a mode to preview all images at once, I believe I can disable it later.)
Discourse Integration: I can now add a “Read online” link in my Discourse posts, which opens the cloud drive interface when clicked. It looks like this: 呂祖刪定全書十二卷 - General - Open TTC | 中華傳統道文化知識庫與在綫社區
Resource Efficiency: This approach avoids the unnecessary resource consumption common with traditional galleries or image hosting applications. The best way to read a book is to load one page at a time, unlike a photo album where you expect multiple images at once. Loading multiple book pages simultaneously would also be visually confusing, as every page looks quite similar.
I am using Discourse as my website’s homepage, managing about 5,000 books across 31 categories. Each post represents a single book, and the Zfile drive manages the individual content pages for each one. This is the best user experience I’ve found so far, and it’s relatively convenient on desktops, mobile phones, and tablets. I hope this can help others who might have similar needs.
A couple of notes:
Zfile isn’t the only option. It seems its interface primarily supports Chinese, which is a benefit for me. If you have any better recommendations, please let me know.
If a 3D page-turning plugin (simulating a real book-flipping experience, like those available for WordPress) ever becomes available for Discourse in the future, please let me know as well.
Thanks again!