איך להטמיע מספר רב של תמונות AVIF בפוסט יחיד לקריאת ספרים אונליין?

שלום,
הפרויקט שלי הוא לבנות קהילה המתמקדת בתרבות ה"דאו דה ג’ינג". יש לי למעלה מ-5,000 ספרים עתיקים שאני צריך להציג, ודחסתי את כולם לפורמט התמונה AVIF. חלק מהספרים הללו מכילים עד 2,500 תמונות AVIF.
השאלה שלי היא: כיצד אוכל להכניס את התמונות הללו לפוסט יחיד ב-Discourse כדי לאפשר למשתמשים שלי לקרוא אותן באינטרנט?
אני מחפש פתרון, אולי תוסף, שיכול לספק את התכונות הבאות למשתמשים בתוך פוסט:
לעבור בקלות קדימה ואחורה בין תמונות (כמו דפדוף בדפים).
היכולת לקפוץ ישירות למספר תמונה ספציפי.
באופן קריטי, התמונות חייבות להיטען באופן עצל (lazy-loaded); הן צריכות להיטען רק כאשר המשתמש מנווט אליהן, לא בבת אחת כאשר הפוסט נפתח.
הקבצים שלי מאורגנים כולם בסדר מספרי והם בפורמט AVIF. כל ספר מכיל בתיקייה משלו. גודל התמונה הממוצע הוא 150kb, וספרים מכילים בדרך כלל בין 300 ל-1,000 עמודים, עם כמה חריגים המגיעים ל-2,500 עמודים.
מדוע יש לי דרישה זו?
אוסף הספרים שלי עצום, כיום עולה על 350GB. דחיסתם ל-AVIF הייתה הכרחית לניהול האחסון.
פורמטים כמו AVIF ו-WebP אינם ניתנים לאריזה בקלות לקובץ PDF יחיד.
אריזת הספרים כארכיוני ZIP או RAR מונעת קריאה באינטרנט. שימוש בפורמטי ספרים אלקטרוניים כמו CBZ ייצור עומס גבוה מדי על השרת.
תודה רבה על עזרתך!

לייק 1

אני בקושי אומר את זה, אבל אני לא בטוח ש-Discourse הוא כלי טוב לבעיה שלך.

אם אתה בכל זאת רוצה, הייתי כנראה עושה משהו כמו יצירת נושא לכל ספר ואולי פוסט לכל פרק, אם זה הגיוני (אולי אין פרקים?).

ואז תוכל להשתמש בסקריפט ייבוא שיקרא את שם התיקייה וייצור נושא ואז יעשה משהו כמו

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

ואז תשתמש בזה כדי ליצור נושא.

תצטרך להסתכל בספריית סקריפטי הייבוא כדי למצוא כמה דוגמאות ליצירת נושאים, אבל זה רעיון כללי.

ואז זה יכניס את כל התמונות לנושא/פוסט יחיד. ואז יש כמה כלים שיאפשרו לך לגלול בין הרבה תמונות, אני חושב. אולי מישהו אחר שם לב אליהן יותר ממני.

2 לייקים

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

אני לא מאמין שזה עניין של אירוח, אלא שימושיות בקריאה. עבור אנשים יותר מערביים ומסוגננים, זו שאלה דומה מאוד להצגת קומיקס. ועבורם, ייתכן שימצאו פלטפורמות מתאימות, אבל אני די בטוח שגם וורדפרס יכולה להציע פתרון.

ואז החיבור של תוכן וקהילה/דיון על ידי Discourse הוא טריוויאלי לחלוטין.

אבל במערכת האקולוגית של Discourse, משהו כמו Discpage הציעה, יכול להיות פתרון נוסף. אבל הוא שבור.

2 לייקים

There are comic file format online reader available, which load 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?

לייק 1

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!

4 לייקים

Your project looks really interesting!

Have you tried wrapping your images in [grid] markdown? A topic like https://openttc.com/t/topic/54 would be much more manageable.

Personally, I have digitized photo albums and saved them in PDF files and uploaded them to topics in Discourse. Then the inline PDF preview theme component lets my members scroll through them directly in Discourse. The advantage with this is that the books stay intact.

2 לייקים

Thank you very much! Sir
Recently, I’ve been working on development, switching between multiple servers. Therefore, the openttc.com link referenced in this post might be unstable.
Once I finish my current work, I will post an updated link in this thread to showcase the results of our discussion (embedding Zfile into Discourse posts, which might be useful for someone in the future).
In fact, after much thought, I have temporarily abandoned my previous approach.
The reason is that it’s too troublesome to manage. If I add new content later, I would have to manage it separately in both Discourse and Zfile systems and manually synchronize them.
I am currently trying to embed content directly into posts as PDFs. Some individual PDFs are over 2GB in size, so there are still a bunch of issues to deal with slowly…
Thank you all for your attention. This community is truly lovely!
I wish you good health and happiness to your families!

2 לייקים

Thank you, and same to you and yours! :hugs:

I am going to close this topic as it seems you have been able to find some good options for resolving your issue. If you have challenges again in the future you can start new topics.