Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > adding an image to a form on a new doctype, get a GUID View modes: 
User avatar
Member
Member
dcollins-marketwired - 1/27/2014 12:53:58 PM
   
adding an image to a form on a new doctype, get a GUID
I have made a new doctype 'speaker' and am putting it into a repeater so the author can add as many speakers to the 'event' page as they wish.

It's mostly working except for the image. I added a field type 'file' to the form, allowing the author to upload a mugshot. This works OK in Page mode - I get my image uploaded and I can see it's filename and even preview it:
User image

but what I get output on the page is nothing more than a GUID:
<div class="speaker-pic">
<img src="286155c5-d7ba-4219-b885-8fa4c73f8cc7">
</div>
<div class="speaker-name">Zachary Reiss-Davis</div>
...

My transform looks like this:
<div class="speaker">
<div class="speaker-pic"><img src="<%# Eval("Pic") %>"/></div>
<div class="speaker-name"><%# Eval("Name") %></div>
...

Two questions:
1] why am I getting a GUID instead of a filepath? and, more broadly
2] from the point of view of a content author, is this "file upload" the optimal/preferred way to point a form at an asset? Perhaps it could it be uploaded to a media library first, or something like that?

User avatar
Member
Member
dcollins-marketwired - 1/27/2014 1:06:55 PM
   
RE:adding an image to a form on a new doctype, get a GUID
Transofrm Methods
I see I need to use GetImage, but...
<div class="speaker-pic"><img src="<%# GetImage("Pic") %>"/></div>

Ohhh I see: "Returns complete HTML code of the image whose GUID is stored in the column of the given name."
So:
<div class="speaker-pic"><%# GetImage("Pic") %></div>

Thanks!

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/27/2014 2:41:44 PM
   
RE:adding an image to a form on a new doctype, get a GUID
Nice find!

If you didn't want to use the GetImage() method you could use this URL and get your image based on the GUID.
<img src='/CMSPages/GetFile.aspx?guid=<%# Eval("Image") %>&width=100&height=75'/>