0

I have the following code which works fine, however the image loads at its original width at 540px. I would like to change the width of the image. I've tried adding style to <td> but it doesn't seem to work. What can I add to the following html code to set max-width of 270px?

AMPSCRIPT

SET @ImageId = "28034"
SET @FeatureImage1 = ContentImagebyID(@ImageId)
 ]%%

I've tried using the following HTML which results in no changes to the width of the image:

<td align="center" class="fluid" style="width: 100%; max-width: 270px; height: auto; padding: 0px; text-align: center;" width="270">
                 <a alias="" conversion="false" data-linkto="http://" href="http://" target="_blank" title="">%%=v(@FeatureImage1)=%%</a></td>

If I don't use the ContentImagebyID, it works fine with the following code, however I need a solution as I am wanting to dynamically populate an area in the table.

<td align="center" class="fluid">
<a alias="" conversion="false" data-linkto="http://" href="http://" target="_blank" title=""><img alt="Alt-Text" data-assetid="19943" src="http://image.companya.com/lib/fe4115707564067d701674/m/1/80e426bc-1964-41a2-a48c-34298e8fbbd8.jpg" style="width: 100%; max-width: 270px; height: auto; padding: 0px; text-align: center;" width="270"></a></td>
1

I think it's much easier to manually add the image URLs now that you can enable the Predictable File URLs in the Content Builder Administration settings.

It's better than working around the annoyances of the ContentImagebyID function, in my opinion.

  • Yup - I couldn't take a shortcut but had to create individual content blocks with corresponding urls. Thank you! – s3329893 Sep 12 at 2:50
  • Sweet. Would you mind checking the check-mark beside my answer? I'd appreciate it. For more information about accepting answers, take a look at this FAQ. – Adam Spriggs Sep 13 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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