craft-snippets / Craft-image-toolbox

Craft CMS plugin that helps with the use of image transforms in templates.
Other
16 stars 0 forks source link

AssetTransform #6

Closed pette87 closed 3 years ago

pette87 commented 3 years ago

Hi,

have following error:

Setting unknown property: craft\models\AssetTransform::(max-width: 600px)

                        `{% set hero = block.background.one() %}
                        {% set transforms = {
                            '(max-width: 600px)': {
                                width: 100,
                            },
                            '(max-width: 999px)': {
                                width: 400,
                            },
                        } %}

                        {{craft.images.picture(hero, transforms) }}`
piotrpog commented 3 years ago

@pette87 picture is used for image without breakpoints. For breakpoints, you can use pictureMedia.

{{craft.images.pictureMedia(hero, transforms)}}

I will redesign functions a bit in the future by the way, so both of these functionalities can be used by single function.

pette87 commented 3 years ago

Thanks 👍