Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Thumbnail method in transformation View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/28/2013 7:50:09 AM
   
Thumbnail method in transformation
I'd like to create a thumbnail for an image gallery that is always a given height/width and is not distorted. For instance I have a node with 10 images, 8 are landscape and 2 are portrait. Of the 8 landscape, 4 of them are 100x200 and the other 4 are 200x350. The portrait images are 325x125. Ideally I'd like to simply start in the middle of the image and "cut" out a thumbnail that is 100px square.

User avatar
Member
Member
kentico_sandroj - 9/2/2013 1:10:06 PM
   
RE:Thumbnail method in transformation
Hello,

It seems that cropping is not supported in the current version; however, you may be able to use CSS with a custom function. Would that work for you?

Best Regards,
Sandro Jankovic

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 9/3/2013 9:43:42 AM
   
RE:Thumbnail method in transformation
Thanks Sandro. CSS would work although I'll have to be considerate of the file size and maybe do some work on ensuring I'm not displaying a 100x100px image that is actually 2500x1500px and 2MB in size. I'm guessing I can use the MaxSide property of the GetImage() method to do this correct?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 9/5/2013 5:55:31 AM
   
RE:Thumbnail method in transformation
Hi Brenden,

yes, you are able to use one of the available GetImage methods, however they will just resize the image and keep the aspect ratio, while you want to crop the image when aspect ratio is not important, so for this specific purpose you will need to create a custom method where you can handle the image cropping with some 3rd party library.

Best Regards,
Martin Danko