Zola: Is there a way to get image size?

Created on 12 Mar 2019  Â·  10Comments  Â·  Source: getzola/zola

It would be useful if I had a method I could use to get the dimensions of images. A gallery library I'm trying to use requires that I provide the dimensions of each image.

done

Most helpful comment

I started on a PR for this. I might have some questions for you once I get a little further along.

All 10 comments

There is no way to do that currently.
I assume you mean a JS gallery library? I've never seen on requiring the dimensions, do you have a link to it?

Generally I've found it useful when lazyloading images in a specific frame - e.g. have a thumbnail image click into a super hi res version that takes a bit to load in a modal. The nice part would be knowing how big to make the modal before the image is actually loaded in. I was fairly sure lightbox did something like this, but not too sure. I can see the use case though for just general usage.

Another (slightly more niche) use I can think of is to display fullres image dimensions similar to how wikipedia has them labeled along with their data size.

I'm using photswipe. Here is their explanation of why they require the size: http://photoswipe.com/documentation/faq.html#image-size

I started on a PR for this. I might have some questions for you once I get a little further along.

@Keats I made a first pass at implementing this. I need to update the docs but I wanted to check in that this looks good before I update docs and get a PR together.

Thanks! I'll have a look a bit later this week

I think I would rather have a single Tera function to get image metadata (name to be bikeshedded), which returns a struct/hashmap of things like {height,width, etc...} so we can easily extend it later if we want to read EXIF data or other image metaadata for example

Smart. I can make that happen. I'll start on those changes

@Keats I've updated the branch with the feedback. Let me know if that looks any better. If it does I can prep docs for it.

Sorry, I forgot about that. It will be easier to review as a PR but that seems ok

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snsvrno picture snsvrno  Â·  4Comments

svenstaro picture svenstaro  Â·  5Comments

pandark picture pandark  Â·  3Comments

codesections picture codesections  Â·  5Comments

phil-opp picture phil-opp  Â·  3Comments