Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > make Image stored in document show in lightbox View modes: 
User avatar
Member
Member
eagleag - 3/29/2011 3:12:13 PM
   
make Image stored in document show in lightbox
Hi,
I created a document type the has 3 " Attribute type:FILE" fields.
I would like these images to show as thumbs and on onCLick in a lightbox.

I've added the LIGHTBOX webpart to page and tried many different ways to get this to work.
example code:
<a href="<%# GetFileUrl("Picture2") %>" rel="lightbox[group]" rev="ddd" title="<%# Eval("FileDescription", true) %>"><%# GetImage("Picture2") %></a>

I've tried DIRECT UPLOAD and UPLOAD FILE.

How can i get an image that is saved "in' a document (and not as cms.file) to work with lightbox?

THANKS :)

User avatar
Member
Member
kentico_michal - 3/31/2011 3:14:06 AM
   
RE:make Image stored in document show in lightbox
Hi,

You can create a new document type, add a custom field either of type Direct Uploader or Upload File and display it in the Lightbox web part. This should not be any problem.

Please make sure that the Document type property of the Lightbox web part is set to your custom document type.

Please also take a look at following transformations which can be used as a transformation and selected item transformation in the Lightbox web part. You just need to replace the FieldName in GetFileUrl method with the name of the field of Direct uploader or Uplad file type:


Transformation:
<a href="<%# GetDocumentUrl() %>" rel="lightbox[group]" rev="<%# Eval("NodeAliasPath") %>" ><img src="<%# GetFileUrl("FieldName") %>?maxsidesize=150" alt="<%# Eval("DocumentName")%>" /></a>

Selected item transformation:
<%# IfEmpty(Eval("FieldName "), "no image", "<img alt=\"" + Eval("DocumentName") + "\" src=\"" + GetFileUrl("FieldName ") + "?maxsidesize=800\" />") %>



Best regards,
Michal Legen

User avatar
Member
Member
eagleag - 3/31/2011 6:36:41 AM
   
RE:make Image stored in document show in lightbox
hi,
I used your code and lightbox does open but have 2 issues.

1. when I choose transformation for "Selected item transformation" it show on page and NOT "Transformation".

2. If I leave "Selected item transformation" empty I see three images with links, onlick lighbox open but show all three images.

here is my code:

3 "upload file" fields in one doc.

"Transformation"

<table>
<tr>
<td >
<a href="<%# GetFileUrl("Picture1") %>" rel="lightbox[group]" rev="<%# Eval("NodeAliasPath") %>" ><%# GetImage("Picture1") %></a>
</td>
<td >
<a href="<%# GetFileUrl("Picture2") %>" rel="lightbox[group]" rev="<%# Eval("NodeAliasPath") %>" ><%# GetImage("Picture2") %></a>
</td>
<td >
<a href="<%# GetFileUrl("Picture3") %>" rel="lightbox[group]" rev="<%# Eval("NodeAliasPath") %>" ><%# GetImage("Picture3") %></a>
</td>
</tr>
</table>


all three iimages have link like this:
http://mySite.com/getattachment/3aad7436-b0a2-43a5-801b-fa58cdb18120/test-1234.aspx

this part "/test-1234.aspx" is at end of all three, only thenguid changes.


"Selected item transformation"

<%# IfEmpty(Eval("Picture1"), "no image", "<img alt=\"" + Eval("DocumentName") + "\" src=\"" + GetFileUrl("Picture1") + "?maxsidesize=800\" />") %>
<%# IfEmpty(Eval("Picture2"), "no image", "<img alt=\"" + Eval("DocumentName") + "\" src=\"" + GetFileUrl("Picture2") + "?maxsidesize=800\" />") %>
<%# IfEmpty(Eval("Picture3"), "no image", "<img alt=\"" + Eval("DocumentName") + "\" src=\"" + GetFileUrl("Picture3") + "?maxsidesize=800\" />") %>



Any idea how to fix?

THANKS :)


User avatar
Member
Member
eagleag - 3/31/2011 6:41:00 AM
   
RE:make Image stored in document show in lightbox
forgot to mention that when light box does open it show all 3 images.

thanks

User avatar
Member
Member
kentico_michal - 4/11/2011 3:57:58 PM
   
RE:make Image stored in document show in lightbox
Hi,

Well, the Lighbox gallery web part is not intended to display more than one field of one document. I would recommend using either unsorted or grouped attachment and use the Attachment image gallery web part to display them. This web part displays image gallery using Lightbox flash layout and functionality.

Best regards,
Michal Legen