I imported all of the posts from a WordPress blog, using a regular expression to update the image URLs to their new location in a Craft Asset Source. However, many of the original photos are straight out of the camera - 2000x3000px or whatever. What I would like to do is use that same regex to update them to a transformed version: so /wp-content/uploads/2014/12/photo.jpg would become /media/blog/_fullWidth/photo.jpg. I already set up that replacement and it's working great.

The problem is that the "Full Width" transform hasn't been generated, and just calling the URL from a Rich Text field bypasses Craft, so it never gets generated. Short of manually re-adding every photo through Redactor with the transform, is there any way to force Craft to generate a particular transform on all the images in an asset source?

  • Might be easier (and less processor intensive) in the long run to just download all the images, run them through photoshops 'File>Scripts>Image Processor' in a batch, re-upload them, and update the assets index. Commented Feb 12, 2015 at 18:52
  • +1 for Douglas's suggestion. Running all of that through PHP/GD/Imagick is going to be a headache.
    – Brad Bell
    Commented Feb 12, 2015 at 19:01

1 Answer 1


You could just make a temporary template that makes Craft generate them for you. And depending on how many these are, you better use limit and offset with your craft.assets call.

{% set images = craft.assets.source('myAssetSource').limit(50).offset(0) %}
{% for image in images %}
    <img src="{{ image.url('fullwidth') }}">
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.