timmy icon indicating copy to clipboard operation
timmy copied to clipboard

Notice: Trying to access array offset on value of type bool in mindkomm/timmy/lib/Image.php on line 499

Open drzraf opened this issue 3 years ago • 1 comments

That line is $this->max_width = $this->meta['width']

My Timber templates contain things like: srcset="{{ bg_image_landscape|get_timber_image_srcset('hero') }}"

And this is the tail of the stack when this happens:

15 | 0.4629 | 16296816 | get_timber_image_srcset( $timber_image = 27465, $size = 'hero', $args = ??? ) | .../Environment.php(497) : eval()'d code:93
16 | 0.4655 | 16301776 | Timmy\Image->srcset( $args = [] ) | .../functions-images.php:70
17 | 0.4655 | 16302152 | Timmy\Image->width(  ) | .../Image.php:342
18 | 0.4656 | 16302528 | Timmy\Image->max_width(  ) | .../Image.php:538

drzraf avatar Jul 07 '22 12:07 drzraf

Hey @drzraf

Just looking at this issue now. There probably was no metadata generated for that image, not even the original width and height. Of course we should check for that in Timmy. I could reproduce your issue in a test, so we just have to figure out how to solve this best.

May I ask how bg_image_landscape was loaded/uploaded into WordPress? Because usually, the width and height is set on the image metadata and the problem is that the sizes array wasn’t generated in earlier versions of Timmy. In your case, it seems like the basic metadata wasn’t loaded, either.

gchtr avatar Jul 25 '22 11:07 gchtr

This is fixed in the latest beta release: https://github.com/mindkomm/timmy/releases/tag/1.0.0-beta.3.

gchtr avatar Jan 09 '23 07:01 gchtr