Media gallery image display from form in page

Alan Isaacson asked on December 2, 2015 14:14

On one of my page types I have a media selection field that allows me to include an image from a media gallery. However I cannot get the image to display on the page. If I use {% GetImage ("Currentdocument.IllustrationImageFromMediaLibrary") %> I get the image path appear. If I use <img src="{% IllustrationImageFromMediaLibrary %>" /> then I get a broken image. Is there a way via a Text/XML transformation to insert the image selected in that field to appear on a page. I do not need a repeater as it is one image on each page only.

Correct Answer

Jan Hermann answered on December 2, 2015 14:49


the Media selection form control stores paths to chosen media files, so you should be able to put the macro directly as the src attribute. However, if I take a look at your macros, there are broken with different closing bracket. The code should look like this:

<img src="{% IllustrationImageFromMediaLibrary %}" />

Best regards,
Jan Hermann

0 votesVote for this answer Unmark Correct answer

Recent Answers

Dawid Jachnik answered on December 2, 2015 14:43


If you don't need repeater to this image why do uoi use Text/XML transformation for displaying this? Use static text and

<img src="{% IllustrationImageFromMediaLibrary %>" />

if you want to display image from current document. This field should contains relative path to image, eg. "/EcommerceSite/media/HeadlineBannerImages/apple_ipod_shuffle.jpg?width=700&height=217&ext=.jpg"

If this doesn't help could you provide more information? Which version of Kentico do you use? List here result of your macros (broken path's to image)

0 votesVote for this answer Mark as a Correct answer

Alan Isaacson answered on December 2, 2015 15:32 (last edited on December 2, 2015 15:32)

Thanks for both of the answers. I needed the image in a transformation as I then add various dynamic overlays based on other fields. It was the simplicity of using the > rather than } by mistake.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.