pmoreno-rodriguez / grav-theme-editorial

Editorial is a GravCMS port of the Editorial theme from HTML5Up.net.
Other
13 stars 2 forks source link

Featured images not resizing properly #49

Open kanabalt opened 2 months ago

kanabalt commented 2 months ago

When I add a featured image with default settings, the image doesn't resize properly. It squishes instead.

pic

pmoreno-rodriguez commented 2 months ago

Could you indicate where it occurs (default page, blog page, blog list page, etc)?

kanabalt commented 2 months ago

Default. But also on blog, item, etc.

pmoreno-rodriguez commented 2 months ago

Have you got any online Grav site where I can see this issue in action?. The default and others templates use cropZoom filter, with image width and height values. On demo site, you can see with inspect tools, the code under the images.

Are you using the latest version of theme?

kanabalt commented 2 months ago

Sure! https://ratrak.si/dsr/novice/scenarnica-plus-nicesar-nas-ne-sme-bit-strah

I'm aware of cropZoom and I've removed it from blog-list-item.html.twig because I didn't want blog list to show images, but I don't think that's the problem (I've tried returning it, still not working properly). Everything is up to date. 🤷‍♂️

pmoreno-rodriguez commented 2 months ago

Hi. I've made a new blog page in the demo page, similar to your page. I'm not able to reproduce this issue with defaults values. Maybe you will need to clear old cache from Grav and clear your browser cache.

pmoreno-rodriguez commented 2 months ago

Any advance with this issue?

kanabalt commented 2 months ago

Clearing cache doesn't work because it doesn't work on any kind of device (tried pc, mac, ios, android). I've tried disabling all the plugins as well but that also doesn't change anything. It's a really weird problem since it's a simple cropZoom function that should be working. I've also tried switching the page template from default to blog, to item, but it's still the same problem everywhere. Not really sure what to try anymore except commenting out the "featured image" feature. I'll play with it some more first, though.

kanabalt commented 2 months ago

Happens in the gallery as well: https://ratrak.si/dsr/gallery-test

pmoreno-rodriguez commented 2 months ago

Have you checked the php requirements for Grav in your server? The GD library is used and necessary to manipulate images with php.

pmoreno-rodriguez commented 2 months ago

In your Gallery test page, the browser inspector explicitly displays the image's width and height attributes:

<img itemprop="http://schema.org/image" alt="" class="gallery_content-image" src="/dsr/images/4/b/c/a/8/4bca84281b4bc9b481cd2b3a0fa66809b5166ee0-girl-6920625960720.jpg" width="600" height="450">

In Editorial demo gallery, this is the code:

<img itemprop="http://schema.org/image" title="Picture one" alt="Picture one" class="gallery_content-image" src="/images/e/b/c/5/f/ebc5f627a7bbfb7d8469d06ddab2455a1def5291-q75pic03.jpg">

Thumb width and height attributes are declared in the gallery.html.twig:

{% set thumb_w = page.header.thumb_width|default(600) %}
{% set thumb_h = page.header.thumb_height|default(450) %}
.
.
{% set thumbnail = item_image.cropZoom(thumb_w, thumb_h).attribute('itemprop','http://schema.org/image').html(item_title,item_title,'gallery_content-image') %}

but they are used with the cropZoom filter, not explicitly as thumbnail width and height attributes.

Are you using the latests version of theme?

kanabalt commented 2 months ago

Everything is up to date. I installed a new instance of Grav on my server with your theme and everything works properly. Something is obviously breaking this, either some plugin or I might've busted it somehow in yaml files. Will look into it some more.