1

I am trying to find a way to upload an image via API into the portfolio and then use that uploaded image in an email.

I am able to use the following AMPScript, %%= Image(customer_key) =%%, inserting the customer_key to reference the image. However, I am not able to add inline styling or other attributes on that image tag, the AMPScript only seems to allow an ALT attribute.

I would like to avoid making a separate API call after the upload where I retrieve that same portfolio item, grab the URL and store the value in a Data Extension.

I am hoping that the new Content API will address this issue but in the meantime I would like to figure something out.

Thanks

0

You can extract the URL from what is returned in the Image function by doing this:

%%[
 set @imageTag = Image("ImageCustomerKey")
 set @regEx = "(?<=src=['""])(http[s]?://.*?)['""]"
 set @imageUrl = RegExMatch(@imageTag, @regEx, 1, "IgnoreCase")
]%%
imageTag: %%=v(@imageTag)=%%
imageUrl: %%=v(@imageUrl)=%%

From there, you can re-construct the tag in the form you want.

| improve this answer | |

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.