liwenyip / hugo-easy-gallery

Automagical css image gallery in Hugo using shortcodes, with optional lightbox/carousel gadget using PhotoSwipe and jQuery.
MIT License
573 stars 111 forks source link

images have wrong dimensions #61

Closed js32 closed 3 months ago

js32 commented 3 years ago

Hi! First let me thank you for your work!

I'm having issues getting figures displayed correctly.

The page in Question is here. The first image is added wit the shortcode img.html:

{{ $path := .Get "src" }}
{{ $caption := .Get "title" }}
<div class="fancybox">
    <a data-fancybox="gallery" href="{{ $path | absURL }}" data-caption="{{ $caption }}">
        <img src="{{ $path | absURL }}"  width="100%"  alt="" loading="lazy"/>
    </a>
</div>

and is displayed with correct dimensions.

The second, third and fourth images I've added respectively like so:

{{< load-photoswipe >}}
{{< figure src="/img/fixed-background-bottom.jpg" width="400px" height="auto" >}}
{{< figure link="/img/fixed-background-bottom.jpg" thumb="-small" >}}
{{< figure link="/img/fixed-background-bottom.jpg" thumb="-small" width="400px" >}}

As you can see, the first image has the wrong dimension and the third and fourth one don't display the smaller preview images.. The lightbox is working though.

Edit: I've fixed the thumbnails not displaying... I was using .jpeginstead of .jpg:)

Could you please assist?

Thanks in advance and have a good one :)

EmielH commented 3 years ago

Hi @js32, it's not possible to set the height using the figure shortcode. The width property translates to max-width in CSS. That might explain what you're seeing.

kishorbhat commented 2 years ago

@js32 do you still need help with this? I'm getting a 404 on the linked page.