sitegeist / sms-responsive-images

This TYPO3 extension provides ViewHelpers and configuration to render valid responsive images based on TYPO3's image cropping tool.
GNU General Public License v2.0
34 stars 19 forks source link

string does not work for image #22

Closed DanielRuf closed 6 years ago

DanielRuf commented 6 years ago

<f:image src="{resources.0.url}" treatIdAsReference="false" /> works but not with the sms:image VH as the image parameter is registered as object.

DanielRuf commented 6 years ago

Hm, seems the docs are not very clear. <sms:image src="{resources.0.url}" treatIdAsReference="false" srcset="400, 600, 800, 1000, 1200" width="800" /> works but <sms:image image="{resources.0.url}" treatIdAsReference="false" srcset="400, 600, 800, 1000, 1200" width="800" /> doesn't and it is not directly documented what both arguments (image vs src) mean.

s2b commented 6 years ago

I can't reproduce this behavior. With ec2e38f7a0a37bfd1f4395cd870e02407ea81d3f, I added a testing page to the demo plugin with which you can test all possible combinations. Please let me know if one of those combinations doesn't work for you or if I've missed one.

To enable the testing page, you first have to enable the demo plugin, as described in the extension documentation: https://docs.typo3.org/typo3cms/extensions/sms_responsive_images/AdministratorManual/Index.html#demo-plugin

After that, you should see a new option "Testing page" in the select menu on the demo page. It will render something like this:

bildschirmfoto 2018-03-15 um 21 12 20

If the first code is equal to the second code and the third code outputs something sane (an image with 2 srcsets), everything works as expected.

Concerning the missing documentation for src vs. image, I refer to the official documentation for Fluid ViewHelpers: https://docs.typo3.org/typo3cms/ExtbaseGuide/Fluid/ViewHelper/Image.html#src

DanielRuf commented 6 years ago

<sms:image src="{resources.0.url}" treatIdAsReference="false"

vs

<sms:image image="{resources.0.url}" treatIdAsReference="false"

s2b commented 6 years ago

The official documentation mentions that image only accepts objects while src accepts strings and integers. That's the way the image viewhelper behaves.

DanielRuf commented 6 years ago

Understood.