<p>If you create an image transform in the control panel, the client will be able to choose that transform when selecting an image (in the bottom right corner). But there's no way to get Craft to transform the image based on the size the clients manually set the image to be in the rich text field. </p>

CC BY-SA 3.0
2014-09-22T21:28:06.727Z
2014-09-22T21:28:06.727Z
André Elvan
<p>If you want to customize the image transforms from your templates, you’re going to be better off using a Matrix field instead. You can give the field two block types, “Text” and “Image”, with Rich Text and Assets sub-fields, respectively. Then from your templates, you will have full control over the images’ dimensions when they are output.</p>

CC BY-SA 3.0
2014-10-17T13:57:33.987Z
We've done that with our site but then the problem we encounter is that all the legacy content that we've imported isnt possible to be divided appropriately into the matrix field structure. Would it be possible with a Twig Extension to gather all images and then generate a custom transform with the output?
Seán O'Grady
CC BY-SA 3.0
2014-10-17T17:24:25.530Z
You would be able to parse out the images, but by that point the actual asset model will be lost, and searching for assets based on their URL isn’t very easy to do.
Brandon Kelly
CC BY-SA 3.0
2014-11-18T13:05:38.013Z
@Sean a hacky workaround would be to use the `getRawContent()` method on your redactor field and then apply your custom Twig filter. Have a look at the built-in filter to parse reference tags (Docs: [`parseRefs`](http://buildwithcraft.com/docs/templating/filters#parseRefs), source code: [`public function parseRefs($str)`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/ElementsService.php)) that you could modify upon.
carlcs
CC BY-SA 3.0
2015-02-24T04:02:45.983Z
Hi Brandon, sorry to drag up an old post. Just wondering if there's any official way now of specifying image transforms for image assets in a Rich Text field, to be applied at template render time. There will be situations where implementing the aforementioned solution just aren't possible. Thanks in advance.
Brendan Underwood
CC BY-SA 3.0
2014-10-16T18:29:29.120Z
2014-10-16T18:29:29.120Z
Brandon Kelly
<p>I see how to use Image Transforms when the image tag is its own field but don't see a way to handle images within Rich Text fields or force a size on upload. </p>

<p>I need to have the image dimensions match the size the client sized the image to in the Rich Text field. Is there a way to do this?</p>

<richtext><redactor><image-transforms>
Can images embedded in a Rich Text field be resized on output?
# Can images embedded in a Rich Text field be resized on output?

(Asked by: username_0 on 2014-09-22)

I see how to use Image Transforms when the image tag is its own field but don't see a way to handle images within Rich Text fields or force a size on upload.

I need to have the image dimensions match the size the client sized the image to in the Rich Text field. Is there a way to do this?

**Tags:** richtext, redactor, image-transforms

---

## 2 answers

### Answer by username_1 on 2014-09-22. Score: 3

If you create an image transform in the control panel, the client will be able to choose that transform when selecting an image (in the bottom right corner). But there's no way to get Craft to transform the image based on the size the clients manually set the image to be in the rich text field.


---

### Answer by username_2 on 2014-10-16. Score: 1

If you want to customize the image transforms from your templates, you’re going to be better off using a Matrix field instead. You can give the field two block types, “Text” and “Image”, with Rich Text and Assets sub-fields, respectively. Then from your templates, you will have full control over the images’ dimensions when they are output.

> **Comments:**
> **username_3**: We've done that with our site but then the problem we encounter is that all the legacy content that we've imported isnt possible to be divided appropriately into the matrix field structure. Would it be possible with a Twig Extension to gather all images and then generate a custom transform with the output?  
> **username_2**: You would be able to parse out the images, but by that point the actual asset model will be lost, and searching for assets based on their URL isn’t very easy to do.  
> **username_4**: @Sean a hacky workaround would be to use the `getRawContent()` method on your redactor field and then apply your custom Twig filter. Have a look at the built-in filter to parse reference tags (Docs: [`parseRefs`](http://buildwithcraft.com/docs/templating/filters#parseRefs), source code: [`public function parseRefs($str)`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/ElementsService.php)) that you could modify upon.  
> **username_5**: Hi Brandon, sorry to drag up an old post. Just wondering if there's any official way now of specifying image transforms for image assets in a Rich Text field, to be applied at template render time. There will be situations where implementing the aforementioned solution just aren't possible. Thanks in advance.  

---

