Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Issue displaying media gallery images View modes: 
User avatar
Member
Member
Mark - 2/11/2010 1:37:31 PM
   
Issue displaying media gallery images
I am having a problem pulling images from the media library.

1. I am storing event icon images in the image gallery to be used later to display with my event lists.

2. I added a new field called EventImage (field type: media selection) to my Event Document type

3. When adding content and I select the image, it brings back url parameters(width, height and ext)
Example: /DSC/media/Event-Icons/icon_cruisingCal.png?width=40&height=34&ext=.png

4. If I remove the query string values from the Content Form field, then the image will not display on the form.

5. I can only get the image to display on my transformation using GetImageByUrl, but it doesnt populate the alt, height or width properties.
Sample Transformation: <%# GetImageByUrl(Eval("EventImage")) %>
Sample Output: <img alt="" src="/DSC/media/Event-Icons/icon_cruisingCal.png?width=40&height=34&ext=.png" border="0" />

Is there something I am doing wrong or any ideas on how to get this to format correctly.

Thanks
Mark

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 2/17/2010 3:37:06 AM
   
RE:Issue displaying media gallery images
Hi Mark,


Regrettably, we do not support this approach by default but you could develop this custom functionality by yourself.

You could create a custom macro – please see here: Macro expressions documentation for more details. You may access the context values in the custom macro so you could evaluate the image field inside the code of custom macro. The image field returns the URL with query strings. You can remove them by this API method:

CMS.GlobalHelper.UrlHelper.RemoveQuery(string url)

The custom macro could return a string- the HTML code of <img> tag according your needs.

If the URL of image is correctly formed it will display the image even without the query strings.


Best regards,
Helena Grulichova