show images via transformation

Sonia Samimi asked on June 10, 2018 08:05

Hi, guys I've created a custom table with a field which I have saved the path of a picture which is related to each record. how could I show the details of the records throgh the repeater with custom query web part transformation, which shows the picture that I have saved path of it in that record.

Recent Answers


Peter Mogilnitski answered on June 10, 2018 21:24 (last edited on June 10, 2018 21:44)

You can use custom table repeater (and add where condition if needed). There are transformation methods for images that you can use. If you have an image path saved in your ImageField then your transformation should simple:

<table>
<tr>
<td><%#Eval("FieldName1")%></td>
<td><%#Eval("FieldName2")%></td>
<td><%#GetImageByUrl(Eval("ImageField"))%></td>
</tr>
</table> 

GetImageByUrl - is intelligent enough and it can work with absolute and relative paths

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on June 11, 2018 16:20

If the field stores the URL of the image (e.g. ImageURL), you can also do these two depending on if you are using ASCX or Macro (HTML) transformation

<img src='<%#Eval("ImageURL")%>' /> or <img src="{% ImageURL %}" />

0 votesVote for this answer Mark as a Correct answer

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