Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Media library and Media Selection View modes: 
User avatar
Member
Member
adegiamb - 5/24/2011 4:46:36 PM
   
Media library and Media Selection


I have a document type Bio that contains a field Bio Image text 255 that use the Media Selection control. The problem I am having is the field is storing the URL to media item and not a GUID. The reason I need the GUID is that I can call the method MediaFileInfoProvider.GetMediaFileUrl(fileGuid,siteName) to get details about file. The one field that I need is the description of the file that I need to display. How can get media selection to save the guid and not the path to database field?

Thanks

ADG

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 5/25/2011 3:07:27 AM
   
RE:Media library and Media Selection
Hello,

You can try to use the CMS.MediaLibrary.MediaFileInfoProvider.GetMediaFileInfo(String, String, String) to get the MediaFileInfo instead of your current approach so you won't need the GUID to obtain the info object. Within this object is everything you need to know about the media file you are working with. For more information on the mentioned methods and objects please our API documentation. If you still want to save the GUID instead of the path you can create a custom form control which would save you the GUID into the database as described in the following article. You can check how we are implementing the form controls in the CMSFormControls folder.

Best regards,
Boris Pocatko

User avatar
Member
Member
adegiamb - 5/25/2011 4:37:13 AM
   
RE:Media library and Media Selection
Hey Boris,

how can i use that api when the media selection control saves /getmedia/d8ba8df2-a1f5-4fe0-b6ef-78247928c613/bio1.aspx?width=600&height=337&ext=.jpg to the database field. Would i need to parse the value?

thanks

ADG

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 5/25/2011 7:13:40 AM
   
RE:Media library and Media Selection
Hi,

Yes, parsing the URL is the simplest solution.

Best regards,
Ivana Tomanickova