Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Images in (Kentico) Custom Table? View modes: 
User avatar
Member
Member
foobar17554 - 7/9/2010 11:33:30 AM
   
Images in (Kentico) Custom Table?
I want to be able to include images in a Custom Table (through Kentico, not an external db). Similar to what you can do in a Document. Is this possible? How?

Thanks,
CW

User avatar
Member
Member
kentico_pavelk - 7/12/2010 6:40:35 AM
   
RE:Images in (Kentico) Custom Table?
Hello,

You can create a new field with these parameters:
Attribute type: Text
Field type: Image Selection


This allows you to upload images from the content tree. You can find more details in our Developer's guide:
http://devnet.kentico.com/docs/devguide/index.html?managing_custom_tables.htm


Best regards,
Pavel Knotek

User avatar
Member
Member
foobar17554 - 7/12/2010 8:39:55 AM
   
RE:Images in (Kentico) Custom Table?
Pavel,

That's great, thanks.

Now my next issue: How do I display that image in a transformation? I've tried using GetFileUrl("Photo") (Photo being the name of the field), but that doesn't work. I get a long, GUID-y path with just the .aspx extension at the end (the filename seems to be being cut off). What I would really like is just the path to the uploaded file in the content tree (an image, in this case), so I can display it as part of the transformation.

Thanks for the help,
CW

User avatar
Member
Member
kentico_pavelk - 7/13/2010 5:34:22 AM
   
RE:Images in (Kentico) Custom Table?
Hello,

The Photo field stores NodeGuid of the document (image in your case). You can use following expression in the transformation:
<%# GetImageByUrl(GetDocumentUrl("Photo","")) %>

It returns an img tag with URL like this: /getdoc/<guid>/<name>.aspx

If you want to have a URL like /images/myimage.aspx, you would need to write a custom function. Please find more details in the Developer's guide.
http://devnet.kentico.com/docs/devguide/index.html?adding_custom_functions_to_transformations.htm


Best regards,
Pavel Knotek