Technical support This forum is closed.
Version 1.x > Technical support > Re: Kentico v2.0 Showing images View modes: 
User avatar
Member
Member
marie - 10/30/2006 6:01:56 PM
   
Re: Kentico v2.0 Showing images
John,

Try this in your transformation:

<asp:Image Runat="server" ImageAlign="left" ImageUrl='<%# ResolveUrl( "~/GetFile.aspx?filepath=" + Kentico.CMS.TreeEngine.Functions.UrlPathEncode(DataBinder.Eval(Container, "DataItem.CompanyLogo"))) %>' Visible='<%# Kentico.CMS.TreeEngine.Functions.NotEmpty(DataBinder.Eval(Container, "DataItem.CompanyLogo")) %>'></asp:Image>

Good luck!
marie

User avatar
Member
Member
jjones - 10/31/2006 9:34:04 AM
   
Re: Kentico v2.0 Showing images
Marie,
we are using v2 of Kentico which does not use getfile.aspx anymore.
Using GetFileUrl("CompanyLogo") returns something like
~/getfile/ac45d3fe-0600-467e-a3b2-468d552ab458/roadrunners.aspx
where ac45d3fe-0600-467e-a3b2-468d552ab458 should be the guid of the attachment.

Kind Regards,
John

User avatar
Guest
admin - 10/31/2006 2:22:04 PM
   
Re: Kentico v2.0 Showing images
Hi John,

here's an example of displaying an image in your transformation:

<img alt="<%# Eval("ProductName") %>" src="<%# GetFileUrl("ProductPhoto") %>?maxsidesize=120" />

It's taken from the standard cms.product.preview transformation and it renders code like this:

<img alt="product1" src="/kenticocms/getattachment/8afd3a6c-00fa-48e2-9d6d-286ebb21086f/Acer-AL1511s.aspx?maxsidesize=120" />

This works if you save the logo image as a part of the document. If you're using an image selection field type, you may need to use code like this:

<img src="~/getfile/<%# Eval("NodeGUID") %>/logo.aspx" />

The difference is this:
- if you store the file as a part of the document, its attachmentGUID is stored in the database table
- if you store the file as a separate document (cms.file), its NodeGUID is stored in the database table

Please let me know if it helps.

User avatar
Member
Member
jjones - 10/31/2006 4:48:13 PM
   
Re: Kentico v2.0 Showing images
Petr,
I tried this and yes it works!

<img src="~/getfile/<%# Eval("NodeGUID") %>/logo.aspx" />

did the trick. I thought I tried that, but obviously not!

Many Thanks,
John

User avatar
Member
Member
Pietro - 12/6/2006 11:44:21 AM
   
Re: Kentico v2.0 Showing images
I have tried it but it doesn't work:

Here is my code : <img src="~/getfile/<%#Eval("NodeGUID")%>globe.aspx"/>

And here is what I get displayed in the page : globe.aspx"/> instead of the image.

Any Idea?

Thanks for helping.

Pietro


User avatar
Guest
admin - 12/7/2006 8:45:14 AM
   
Re: Kentico v2.0 Showing images
Sorry, there was a missing code. This is the correct one:

<img src="~/getfile/<%#Eval("NodeGUID")%>/globe.aspx"/>

Please let me know if this works.

Regards,

User avatar
Member
Member
Pietro - 12/7/2006 4:01:38 PM
   
Re: Kentico v2.0 Showing images
Hi,

I tried but with no results :-(

Here is the code I entered in CMS according to what you wrote : <img src="~/getfile/<%#Eval("NodeGUID")%>/globe.aspx"/>

And here is the rendering in Html : <img%/>/globe.aspx"/>


????

User avatar
Guest
admin - 12/8/2006 1:24:50 PM
   
Re: Kentico v2.0 Showing images
Well, could you please send me the whole transformation? It seems there might be some un-closed tag in the previous code.

Best Regards,