New answers tagged

1

Found it, this works: <img src="{{ dataUrl('@webroot' ~ myAsset.getUrl({width: 200, height: 200}, true)) }}" /> Two important things: prepend the @webroot alias to the myAsset.getUrl(...) set the second parameter of getUrl(...) to true: myAsset.getUrl({...}, true). This ensures that a real file path is returned by getUrl, because the image ...


1

You can use Asset::setTransform or Asset::copyWithTransform to get (a copy) of the asset object with your transform applied. Then you can pass that into dataUrl(). {{ dataUrl(myAsset.withTransform({width: 200, height: 200}) }}


0

One method that comes to my mind is to create an asset configuration in admin panel (Settings -> Assets), where you can create different Image Transform configurations. For example, I can create an Image Transforms called Thumbnail then set the required dimensions and quality of the image. Once you create an Image Transforms, you can utilize them with ...


Top 50 recent answers are included