Skip to content

feat: Media Gallery #219

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

Open
rochacbruno opened this issue Jan 29, 2025 · 8 comments
Open

feat: Media Gallery #219

rochacbruno opened this issue Jan 29, 2025 · 8 comments
Assignees

Comments

@rochacbruno
Copy link
Owner

Inspired by the comment on https://blog.zicon.no/marmite.html

My art gallery is currently powered by Hugo, but it cost me stupid amounts of annoying hassle to get it working and I'm enjoying exactly zero parts of the process. I'll be switching away the second I find a suitable replacemen

I want to bring that feature to Marmite, how will that work?


As an artist/photographer/publisher
I want to have a folder of media published to a gallery website,
organize it on streams and tags, make it searchable.


Implementation

Config

On marmite.yaml

extra:
  media_gallery:
    source: path/to/media
    other_configs: {..}

Backend

Knowing there is a extra.media_gallery_source as a path marmite will:

  • Scan the folder and aggregate all media files (png,jpg etc)
  • If not exists, create a filename.md file, including the image
  • If images are named following the pattern filename_00.ext (in fact the aggregation pattern can be configurable) and aggregate the media under the same .md
  • If not part of the filename, marmite will extract date (for sorting) from the image file attributes.
  • Marmite will create thumbnails

Also

  • Marmite will also look for subfolders on the same path, if a subfolder is found, marmite will create a folder.md and aggregate all the media contents.

Front-end

  • Marmite will render a gallery.json (in case someone wants to build JS front end fot it)
  • Marmite will serve the main index for the gallery as a flat html
  • Sub folders will be rendered also as flat named html
  • The media content will be copied to the content/media/gallery and served from there (to make it easier for nginx rules)
  • The HTML/JS/CSS will provide basic grid/list layout with thumbs and zooming.
@Marcelo-maga
Copy link
Contributor

I want to do this, can you assign this issue to me?

@Marcelo-maga
Copy link
Contributor

do you have a list of file extensions that will be supported?? 👉👈

@rochacbruno
Copy link
Owner Author

@Marcelo-maga good question, maybe we can start with the basics and make it extendable?

Top of mind I remember about the common JPG, PNG, Webp, Gif, BMP

However I know photographers may use other formats like TIFF and RAW.

If we can't find a crate that supports multiple formats, we can maybe delegate that part to an external process?

What if marmite relies on a configurable extension list and filename pattern and a cmd that could delegate the image conversion to external process such as convert imagemagick ffmpeg etc...

Then on the rendered site we use the standard web formats such as png and jpg.

I am not sure if we have to support videos, but that approach would allow the usage of ffmpeg to get video thumbnails and then embed the oroginal video file in the html.

What do you think?

@rochacbruno
Copy link
Owner Author

found this crate

https://crates.io/crates/image-convert

@Marcelo-maga
Copy link
Contributor

maybe we can start with the basics and make it extendable?

Yess, i think that is the best way, i will start with these basic extensions

If we can't find a crate that supports multiple formats, we can maybe delegate that part to an external process?

in my work, we are looking for a crate to handle some image conversion to add to PDF files, but everything depends on some external library, which is resulting in a lot of discussions about how to distribute it to our clients.

What do you think?

I think we should focus first on making a basic but functional feature, without spending much time on this conversion from one to another extension.

I will continue thinking about something for this conversion part, as it is one of my current tasks at work, if I find something related to this, I will come back here so we can discuss it a little more.

@Marcelo-maga
Copy link
Contributor

Now a little about the code itself, I started implementing the functionality and I'm not very confident with what I've done so far and would like your opinion on it.

I implemented one more step in the generate function in site.rs

Image

Image

Do you think there is something wrong??

@rochacbruno
Copy link
Owner Author

Hi @Marcelo-maga I think it is in the right direction,
A new step on the site generation pipeline calling a function to handle the media gallery,

The iterations on handle_media_gallery can use the same approach as render_templates uses and also parallelize its loops.

But we can start with a non-parallel implementation and change later.

@Marcelo-maga
Copy link
Contributor

Hi @rochacbruno, great!!

Thanks for the feedback and for helping me with my next step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants