okkur / syna

Highly customizable open source theme for Hugo based static websites
https://syna.okkur.org/demo/
Apache License 2.0
250 stars 134 forks source link

Items get resized wrong #775

Closed IvanTurgenev closed 4 years ago

IvanTurgenev commented 4 years ago

Is this a BUG REPORT or FEATURE REQUEST?: bug

What happened: Image get resized wrongly What you expected to happen: Image get resized and centered correctly How to reproduce it (as minimally and precisely as possible): use items, create an image with 300x110 ratio, a perfectly centered png, gets shifted because bad resizing Anything else we need to know?:

Environment:

includes generated images and fragment md bug.zip

mpourismaiel commented 4 years ago

We resize the image using Hugo. The line responsible for this is:

/layouts/partials/helpers/image.html:44

{{- .root.page_scratch.Set "resource" ((.root.page_scratch.Get "resource").Fill .resize) -}}

Which is called by:

/layouts/partials/fragments/items.html:28

<img src="{{ partial "helpers/image.html" (dict "root" $self "this" $this "asset" . "resize" "300x110") }}" class="p-2 w-75 mb-2" alt="{{ .text | default $item.title }}">

Since Syna is a theme within the bounds of Hugo, we have to rely on Hugo to perform functionalities that rely on third party software or anything in general that requires other libraries that are not available within the build system which is Hugo.

I suggest reporting the issue to Hugo as we're unable to fix the issue within Syna.

Closing this issue for now. Let us know if you think we can change or add something that would fix the issue.