Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Images related to documents View modes: 
User avatar
Member
Member
dima - 1/19/2011 8:47:49 AM
   
Images related to documents
Hello,

I am planning to create a document type that would have related images - not just images, but pairs thumbnail+fullsize. If it was just a general set of images I would probably considered using the document attachments functionality. But in this case I am afraid that wouldn't enough.
So I've decided to create a separate document type DocumentImages with three fields: Title, Thumbnail, FullSize. I will make it possible to add documents of this type underneath my documents and I believe it should work.

Please correct me if there is a better way to implement that.

Thank you

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/20/2011 4:20:11 AM
   
RE:Images related to documents
Hi,

would images be downloadable in full and thumbnail size or would you like to only display images in both sizes? Unfortunately, I do not understand why you cannot use document attachment webpart. Where is the bottleneck in using this method?

In both cases you could use document attachment field type in combination with document attachment webpart.

To manage display size you could use following code in Transformation property of the document attachment webpart:
<img src="<%# GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")) %>" Width="20" Height="40">

<img src="<%# GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")) %>" Width="40" Height="50">

Alternatively you could upload two images (thumbnail, fullsize) and display them using:
<img src="<%# GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")) %>" />

If I misunderstood the issue, could you please provide more details about requested functionality?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
dima - 1/20/2011 4:41:33 AM
   
RE:Images related to documents
Hi Ivana, thanks for the reply.

I would like to implement something like a lightbox image gallery so each document detail page would have a list of thumbnails each of which would be clickable and by clicking on them the fullsize image should appear. I don't see how the attachment webpart could help me with that as it allows to upload only general files - so there is no option to relate two files together (thumbnail+fullsize). Unless I force the user to upload attachment in a specific order i.e. 1st attachment - thumbnail, 2nd- fullsize related to the thumbnail, 3nd - next thumbnail and so on. But that would not be the best way in my opinion.

At the moment I've created the images as children document types and use nested repeaters in transformations.

Hope you understand what I mean.

Thanks!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/20/2011 6:20:21 AM
   
RE:Images related to documents
Hi Dima,

you could download jquery lightbox to achieve your goal.

Integration is very easy, you will need to register javascript in your master page document (Master page tab - in <head> section). Then you can follow instruction described in the above article. To create a link you can use transformation I provided you in my first post. Only the full size image is needed in this case, thumbnail will be created automatically.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
dima - 1/20/2011 6:26:38 AM
   
RE:Images related to documents
Awesome!
Thank you very much!

User avatar
Member
Member
dima - 1/20/2011 6:30:47 AM
   
RE:Images related to documents
Could you tell how exactly thumbnails are going to be created? I am afraid I might misunderstood that bit.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/20/2011 8:11:44 AM
   
RE:Images related to documents
Hi,

here is a small tutorial:

1. create a lightbox directory in the project folder and copy lightbox files into this directory
2. add following lines into <head> tag of your Master page:
<script type="text/javascript" src="~/lightbox/js/jquery.js"></script>
<script type="text/javascript" src="~/lightbox/js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="~/lightbox/css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
$(function() {
$('#gallery a').lightBox(); // Select all links in object with gallery ID
});
</script>

3. add following code into transformation selected next to Transformation name property of document attachment webpart:
<a href="<%# GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")) %>" >
<img src="<%# GetAttachmentUrl(Eval("AttachmentName"), Eval("NodeAliasPath")) %>" width="72" height="72" alt="" /></a>

4. Add following content into Content before property of your document attachment webpart:
<div id="gallery">
5. Add following content into Content after property of your document attachment webpart:
</div>

Now your document attachments should be displayed with lightbox effect.

I hope the tutorial helps.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
dima - 1/20/2011 8:48:36 AM
   
RE:Images related to documents
thanks for such a clear example!
but it's not going to generate thumbnails. all it does - it squashes big images on the client side which is not what I am looking for.
Anyway - thanks a lot for your help. I guess I still haven't found a better solution to the one that was using images as child documents.

User avatar
Member
Member
vugrovec - 5/3/2013 8:20:55 AM
   
RE:Images related to documents
Hi, Ivana!

I have wrong size thumbnails and don't know how, where and what to change to have image gallery thumbnails in proportions with fullsize image - to have landscape image thumbnails for landscape photo. Concretely, I am updating (pro bono) website installed and created by other people. I have only two weeks of the experience with Kentico 5.0 and my problem is here:
http://www.zupa-vugrovec.com/Fotogalerija/Galerija-1.aspx

Thanks in advanced!

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 5/7/2013 6:24:42 AM
   
RE:Images related to documents
Hello,

have you tried to change your stylesheet image height to auto?

It will be something like this:
.Static-Page .Galerija ul li img {
width: 100px;
height: auto;
...
}

Best regards,
Martin Danko

User avatar
Member
Member
vugrovec - 5/7/2013 8:03:59 AM
   
RE:Images related to documents
Yes, that's it – thank you very much, Martin!

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 5/7/2013 8:41:00 AM
   
RE:Images related to documents
Hi,

No problem, I'm glad to hear that. You're welcome!

Best regards,
Martin Danko