Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with ImageExtension after Update to RC34 and sitll in RC35 #1721

Closed
kutulus opened this issue Aug 15, 2020 · 5 comments
Closed

Error with ImageExtension after Update to RC34 and sitll in RC35 #1721

kutulus opened this issue Aug 15, 2020 · 5 comments

Comments

@kutulus
Copy link

kutulus commented Aug 15, 2020

Hi,
I get this error now...

Argument 1 passed to IvoValchev\ImageExtension\Twig\ImageExtension::getResponsiveImage() must be an instance of Bolt\Entity\Field\ImageField or null, array given, called in /Library/WebServer/Documents/bolt4/websrc/var/cache/dev/twig/d1/d16e69a35f023ac10572fd3a6684f9705dab5601eee7601bf75e81fd668198f7.php on line 55
The error appears with Fieldtype "Image" - "Imagelist" works fine.
In RC 33 everything worked...

Using ImageExtension V. 1.1.2
Bolt version: 4.0.0 RC 34 + 35

  • Install type: Composer install
  • Database: sqlite 3.28.0 (without JSON)
  • PHP version: 7.2.21
  • Symfony version: v4.4.11
  • Operating System: Darwin - 18.7.0

Greetings
Stefano

@I-Valchev
Copy link
Member

@kutulus

Hi Stefano, I have some suspicion about what's causing this, but can you provide the twig that goes with this?

Thanks!

@kutulus
Copy link
Author

kutulus commented Aug 17, 2020

Hey @I-Valchev,

This is the Twig:
{{ responsive_image(section.image, 'imagesection') }}

If I do:
{{ dump(section.image) }}

This is the output:

array:8 [▼
  "filename" => "IMG-3317.jpg"
  "path" => "/files/IMG-3317.jpg"
  "media" => 14
  "thumbnail" => "/thumbs/400×400/IMG-3317.jpg"
  "fieldname" => "image"
  "alt" => "ddd"
  "url" => "http://bolt4.test/files/IMG-3317.jpg"
  "extension" => "jpg"
]

Greetings
Stefano

@I-Valchev
Copy link
Member

I-Valchev commented Aug 17, 2020

@kutulus

Right, I'm assuming section is a set field?

This is a bit tricky to fix, because the image extension needs an ImageField, and not just an array/filename.

BUT, here's a little trick that should work for you. Rather than using
{{ responsive_image(section.image, 'imagesection') }}
Use
{{ responsive_image(section.value.image, 'imagesection') }}.

What this does is to get the image object, not just the image value. This is far from optimal, but I hope at least it lets you do the thing :-)

@kutulus
Copy link
Author

kutulus commented Aug 17, 2020

Hi @I-Valchev,

Correct. section is a set field inside of a collection.

Your recommended solution works in my installation.
Thanks for the prompt answer!

Maybe you should adapt the documentary for other users, running into the same problem...

Greetings
Stefano

@I-Valchev
Copy link
Member

Fixed. See I-Valchev/image-extension#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants