We changed our privacy policy. Read more.
2

As far as I know, Craft only provides two controller endpoints that can be used by anonymous users to transform images, both of which won't work well in your case: AssetsController::actionThumb() – This one takes a width and a height argument, but is geared towards generating thumbnails and doesn't work well for a general purpose image resizer, and it doesn'...


2

Most likely you have AWS policy issue. Never seen the problem you've described Craft still will save images copy locally to improve speed. You can disable it using maxCachedCloudImageSize config and set it to 0.


2

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 ...


2

Interesting problem! I took a stab at this, see if this works for your use case. It relies on ImageMagick to check for the top left pixel color (0,0) after the image is uploaded (but will also work if you hit resave). (If you want to check the other 3 corners, you'll need more code but this should get you started.) To use it, you'll need a lightswitch field ...


1

You're close! When you're querying or setting a variable with a Dropdown field you need to use either .value or .label. It looks like you could also simplify your code a bit if the value (or label) of the dropdown is the same as your transform: {% for myBlock in product.imageMatrix.all() %} {% set myImage = myBlock.image.one %} {% set myTrans = ...


1

Craft will store any temporary files it generates into storage/runtime/temp by default, but both Imagick and GD will also likely write to the system's temp folder (likely /tmp but could vary depending on OS and distro).


1

From Brandon Kelly on Discord: If you go to the Assets index page and change the site to your second site. Are you able to see all the same assets there? (Specifically whatever ones appear to be causing this error on your second site) They weren't listed. Had a feeling that would be the case. That's your problem. If you run php craft resave/assets, does ...


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(). {# Apply the transform to myAsset directly #} {% do myAsset.setTransform({width: 200, height: 200}) %} {{ dataUrl(myAsset) }} {# Use this if you need myAsset without the transform later #} {% ...


1

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 ...


1

Does deleting an original asset but keeping the transform folder asset make Craft replace the original file with the biggest transform? No - Craft will always use the originally uploaded asset as the "source of truth" for generating new transforms. You can, however, replace the originally uploaded 8mb+ file with a smaller one, and it'll be used as ...


Only top voted, non community-wiki answers of a minimum length are eligible