API Questions on Kentico API.
Version 6.x > API > CMSAbstractTransformation View modes: 
User avatar
Member
Member
brendan-ignitedcoder - 10/18/2012 3:24:17 AM
   
CMSAbstractTransformation

CMSAbstractTransformation imgHelper = new CMSAbstractTransformation();
sImgPath = imgHelper.GetAttachmentUrl(row["EventTeaserImg"], row["NodeAliasPath"]);

sImgPath renders the wrong path...

Should render... This, I think:
/getattachment/c7d19fa1-3b7e-4e49-99e2-dad36f679377/Test-Event-Entry.aspx

But I get this:

/getattachment/Event-Entry/Test-Event-Entry/c7d19fa1-3b7e-4e49-99e2-dad36f679377.aspx


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/18/2012 5:03:20 AM
   
RE:CMSAbstractTransformation
Hi,

you do not need to work with abstract class in the code behind.

In case you would like to get attachment you can use this method:

CMS.WorkflowEngine.DocumentHelper.GetAttachment(Guid, tree, sitename);

Then you can work with AttachmentInfo object.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
brendan-ignitedcoder - 10/18/2012 5:30:18 AM
   
RE:CMSAbstractTransformation
Please provide a simple example of getting the image url? This makes sense but I need to see how its implemented...

Thanks
Brendan

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/18/2012 5:47:04 AM
   
RE:CMSAbstractTransformation
HI,

here is a code example:

Guid attachmentGuid = ValidationHelper.GetGuid("teaserImaeg", Guid.Empty);
string nodeAlias = ValidationHelper.GetString("NodeAlias", "");
string fileUrl = URLHelper.ResolveUrl(AttachmentManager.GetAttachmentUrl(attachmentGuid, nodeAlias));



The option with nodeAlias="" should work as well. In this case the URL will containg ~/getattachment/<guid>, otherwise the node alias path parts will be included in the attachment url.

Best regards,
Ivana Tomanickova