> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/template-architecture/images-in-s-docs/dynamic-image-solutions/resize-images-in-rich-text-field.md).

# How to: Resize Images from Fields

This page will instruct how to resize images in a rich text field.

## Merge Field Syntax:

```
{{{!Object.fieldname__c replaceAll='#LT#img ,#LT#img height="Valuepx" width="Valuepx" '}}}
```

Take for example we generate an image stored in a rich text field:

<figure><img src="https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2F7ry8zCtarAd5hGxCJwjW%2Fimage.png?alt=media&amp;token=38673bcb-ce5a-4684-bd7a-38685abe9104" alt="" width="188"><figcaption></figcaption></figure>

The generated image is much too large. If we then generate setting the height and width to 100px and 50px:

```
{{{!Opportunity.Rich_text__c replaceAll='#LT#img ,#LT#img height="50px" width="100px" '}}}
```

<figure><img src="https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2F9dp20azaxDrfAAV30t4X%2Fimage.png?alt=media&amp;token=fd81f498-c8a8-4c4e-ad43-8a193e3bd926" alt=""><figcaption></figcaption></figure>

***

## Related List Syntax:

Using the same example, we can alter the image within a related list using:

```
replaceall="<img ,<img style='width:100px'">
```

```html
<table>
<tbody>
<tr>
<th class="table498header">image test</th>
</tr>
</tbody>
<tbody style="page-break-inside: avoid !important; page-break-before: auto !important;"><!--{{!
<lineitemsSOQL>
<class>none</class>
<listname>opportunity</listname>
<soql>select rtfimage__c from opportunity where accountid = '{{!account.id}}'</soql>
<column type="rtf" replaceall="<img ,<img style='width:100px'">rtfimage__c</column>
</lineitemsSOQL>
}}-->
</tbody>
</table>
```

<figure><img src="https://1548664070-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWKNnJmhJBQwhdk5WBFsi%2Fuploads%2FUWH2snZSj3WanQa4NeCS%2Fimage.png?alt=media&amp;token=14732d24-509d-4fba-85ce-88037ce68d75" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
NOTE: This will resize all images. max-width does not currently work at the time of this writing.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.sdocs.com/sdocs/template-architecture/images-in-s-docs/dynamic-image-solutions/resize-images-in-rich-text-field.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
