Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Image cropping View modes: 
User avatar
Member
Member
bondarenko-langora - 7/18/2009 6:58:43 PM
   
Image cropping
Hi.
I will to crop image after resizing by maxsize. How I can to do it?

Alexander

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 7/20/2009 6:40:24 AM
   
RE:Image cropping
Hello,

It's possible to crop-trim image within its properties in CMS Desk -> Content -> Form tab. There is Edit image (green pen) button. You can edit it here according your needs.

Best regards
Ondrej Vasil

User avatar
Member
Member
bondarenko-langora - 7/20/2009 9:12:59 AM
   
RE:Image cropping
Hi, Ondrej
Thank you for the answer. Your idea is good but not exactly for my situation. I want to crop image while images show in LightBox gallery or Media Gallery.
With any words I want to crop images in Transformations.

Other question is how I can to show LightBox view in MediaGallery? I want to see MediaLibraries and LightBox ImageGallery after Media Library selection. Is it possible?

And the last question about flash player. Flash Player can starts after page loading automatically. But what abot player controls? Stop, Play, Forward, Rewind... Where is hides it? Can I use this controls? :)

Best regards
Alexander

User avatar
Member
Member
bondarenko-langora - 7/22/2009 1:47:25 PM
   
RE:Image cropping
Does anybody have answer?

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 7/27/2009 9:04:13 AM
   
RE:Image cropping
Hello,

Regarding cropping images - You need to enforce it within transformation. Unfortunately crop functionality is not provided in transformation by default. There is no function which would do this. Anyway you can develop it by yourself.

Generally you need to create new file (e.g. 'GetTrimmedFile.aspx') for getting images based on '~\CMSPages\GetFile.aspx' file. In this new file you need to modify ProcessFile function to trim particular image (file). You can use GetTrimmedImageData function in imgHelper. You can take inspiration from
'Image editor' control: '~\CMSAdminControls\ImageEditor\ImageEditor.ascx.cs'. Then you need to build you custom function which will use the 'GetrimmedFile.aspx' file and show up the trimmed image within transformation: http://devnet.kentico.com/docs/devguide/index.html?adding_custom_functions_to_transformations.htm

Concerning LightBox for media Gallery - You need to follow instructions here: http://devnet.kentico.com/docs/devguide/index.html?using_custom_media_player.htm. There is bug in current version regarding showing images via lighbox, anyway you can find solution on our Forum: http://devnet.kentico.com/Forums.aspx?forumid=37&threadid=7365.

You should be able to customize the flash player using following hints: http://devnet.kentico.com/docs/devguide/using_custom_media_player.htm

Best regards
Ondrej Vasil

User avatar
Member
Member
bondarenko-langora - 7/29/2009 5:47:51 PM
   
RE:Image cropping
Hi
I follow by your links and
first: I don't see how I can modify flash player for flash control using (controls is standard flash player controls like as stop, rewind, pause)

second: I follow to http://devnet.kentico.com/Forums.aspx?forumid=37&threadid=7365 topic and try to opent example link http://www.kentico.com/docs/devguide/media_player_customization.htm but it doesn't work. At the next step I try to modify file like as discribed in this topic.
I put File.Exists(MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath))
and put
//lightbox mod
int[] dim = ImageHelper.EnsureImageDimensions(Width, Height, MaxSideSize, mfi.FileImageWidth, mfi.FileImageHeight);
Width = dim[0];
Height = dim[1];
this.ltlOutput.Text = "<a href=\"" + url + "\" rel=\"lightbox[gallery]\" title=\"" + mfi.FileTitle + "\"><img src=\"" + url + "\" border=\"0\" width=\""+Width+"\" height=\""+Height+"\" /></a>";


I create Image Gallery under MediaGalleryLibrary at the next step
Now I see page like as MediaLibary in admin section without any component edition possibles.

And I see You are not allowed to see media library content. Permission 'libraryaccess' is required while I try to see Image gallery by Live Site button pressing.

And one little note: I have different code in ~\CMSModules\MediaLibrary\Controls\LiveControls\MediaFilePreview.ascx.cs from examle code. I use Kentico Version: 4.0 Build: 4.0.3328

Best Regards
Alexander

User avatar
Member
Member
bondarenko-langora - 8/1/2009 5:26:48 AM
   
RE:Image cropping
Any comments?

User avatar
Member
Member
bondarenko-langora - 8/2/2009 3:25:03 PM
   
RE:Image cropping
Hi, that's me again.

Thank you for the answers. I have cropped thumbnail in lightbox preview now. But when I press thumbnail for large view I see cropped image in original size. With any words, I see cropped part of image in large size.

How I can revert original image for lightbox large view?

Best regards

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 8/17/2009 1:53:02 AM
   
RE:Image cropping
Hello,

I believe we've worked out your issue. I just want to inform other users if they want to do the same thing just keep in mind there is some caching issue with lightbox. We've prevented from that by adding the query string e.g. crop=1 for the GetTrimmedFile.aspx page.

Best regards
Ondrej Vasil

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 8/3/2009 7:49:23 AM
   
RE:Image cropping
Hello,

regarding the flash controls. You can develop some javascript based controls for that. You may need to google out it. You can also take inspiration here: http://www.permadi.com/tutorial/flashjscommand/

Concerning permission issue - Could you please check if you have set them correctly in CMS Desk -> Tools -> Media Libraries -> Edit -> Security tab? http://devnet.kentico.com/docs/devguide/media_libraries_security.htm

As regards to image cropping - thank you for your files. We are inspecting them and will let you know as soon as we will have some update.

Best regards
Ondrej Vasil

User avatar
Member
Member
chris.percival-oakwood-dc - 3/30/2010 8:36:50 AM
   
RE:Image cropping
I was getting this error ("You are not allowed to see media library content. Permission 'libraryaccess' is required"), even though my permissions were correct. It turned out i had not set my MediaGalleryFolderTree webpart.

User avatar
Member
Member
belindaharris897-hotmail - 12/9/2013 8:22:41 PM
   
RE:Image cropping
What language do you use, you can check this image cropping methods in VB.NET program of an image add-on tool, you can specify the name and storage path of cropped image file.

Function ApplyCrop(img As REImage, x As Integer, y As Integer, width As Integer, height As Integer) As Integer