You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returning an image file also handles populating the alt attribute with the alt field. After resizing or cropping the image, this alt text is however lost, returning an empty alt attribute.
Without resizing
echo$page->image();
<imgsrc="image.jpg" alt="My alt text">
Same image after resizing
echo$page->image()->resize(600);
<imgsrc="image.jpg" alt="">
By simply returning an image, Kirby calls html(), as defined in its __toString() function. This method can be found here:
Description
Returning an image file also handles populating the
alt
attribute with thealt
field. After resizing or cropping the image, this alt text is however lost, returning an emptyalt
attribute.Without resizing
Same image after resizing
By simply returning an image, Kirby calls
html()
, as defined in its__toString()
function. This method can be found here:kirby/src/Image/Image.php
Lines 116 to 134 in 94cc37e
Expected behavior
The alt tag should be returned after resizing/cropping the image.
To reproduce
$page->image()
and see the alt text->resize(600)
or->crop(600, 400)
to it and see the alt text disappearYour setup
Kirby Version
Tested in 4.4.1 and 4.5.0
The text was updated successfully, but these errors were encountered: