Tag reference sheet

Tag library reference for the following tag libraries:

Media tags - version 1.1

Media tag library

Namespace definition: xmlns:media="http://net.sourceforge.openutils/mgnlMedia"

EL Functions

  • desc() Get the description from a media, given the media node itself
  • descLoc() Get the description from a media, given the media node itself and a locale
  • height() Returns the height of the *original* media, if available
  • module() Get the media module instance
  • node() Load a node from the media repository, given the UUID of the media node
  • preview() Get the url to the preview (l45x350 resolution) for a given media node (image or flv/youtube preview)
  • property() Returns a property (nodeData) of the media, given the media Content and the property name
  • resolutions() Get all the resolutions for a given media node
  • size() Get the real size of a resolution for a given media node (image or flv/youtube preview)
  • tags() Get the tags from a media, given the media node itself
  • tagsLoc() Get the tags from a media, given the media node itself and a locale
  • thumbnail() Get the url to the thumbnail (l100x100 resolution) for a given media node (image or flv/youtube preview)
  • title() Get the title from a media, given the media node itself
  • titleLoc() Get the title from a media, given the media node itself and a locale
  • type() Get the media type for a given media node
  • url() Get the url to the media, given the media node itself
  • urlParams() Get the url to the media, given the media node itself and an options map
  • urlres() Get the url to the resolution for a given media node (image or flv/youtube preview) The resolution string has the following pattern [controlChar][width]x[height][;param_key1=param_value1,param_key2=param_value2,
  • usedInWebPages() Get list of path to content nodes of website repository in which the given media node is used
  • width() Returns the width of the *original* media, if available
  • url2() @deprecated use urlParams()

Tagfiles

  • media Displays a media
  • player Renders the audio or video player
  • swfobject Renders the flash-content and the javascript for replacing it

Required attributes are marked with a*

media:desc(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String desc(info.magnolia.cms.core.Content)

Get the description from a media, given the media node itself.

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:out value="${media:desc(mediaNode)}" />
      
    

media:descLoc(info.magnolia.cms.core.Content, java.util.Locale)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String descLoc(info.magnolia.cms.core.Content, java.util.Locale)

Get the description from a media, given the media node itself and a locale. Try to get the value from nodedata "description-{locale}"; if not found get the value from "description-en"; if not found again, get the value from "description".

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:out value="${media:descLoc(mediaNode, pageContext.request.locale)}" />
      
    

media:height(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.Integer height(info.magnolia.cms.core.Content)

Returns the height of the *original* media, if available

media:module()

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: net.sourceforge.openutils.mgnlmedia.media.lifecycle.MediaModule module()

Get the media module instance.

Example

      
      <c:set var="player" value="${media:module().player}" />
      
    

media:node(java.lang.Object)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: info.magnolia.cms.core.Content node(java.lang.Object)

Load a node from the media repository, given the UUID of the media node.

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      
    

media:preview(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String preview(info.magnolia.cms.core.Content)

Get the url to the preview (l45x350 resolution) for a given media node (image or flv/youtube preview)

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <img src="${pageContext.request.contextPath}${media:preview(mediaNode)}" />
      
    

media:property(info.magnolia.cms.core.Content, java.lang.String)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.Object property(info.magnolia.cms.core.Content, java.lang.String)

Returns a property (nodeData) of the media, given the media Content and the property name

media:resolutions(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String[] resolutions(info.magnolia.cms.core.Content)

Get all the resolutions for a given media node.

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:forEach var="res" items="${media:resolutions(mediaNode)}">
        <img src="${pageContext.request.contextPath}${media:urlres(mediaNode, res)}" />
      </c:forEach>
      
    

media:size(info.magnolia.cms.core.Content, java.lang.String)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: int[] size(info.magnolia.cms.core.Content, java.lang.String)

Get the real size of a resolution for a given media node (image or flv/youtube preview). Parameters are the media node and a resolution. You can use 'original' as resolution to get the size of the original image

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:set var="size" value="${media:size(content.image, 'original')}" />
      <img src="${pageContext.request.contextPath}${media:url(mediaNode)}" style="width:${size[0]};height:${size[1]}" />
      
    

media:tags(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String[] tags(info.magnolia.cms.core.Content)

Get the tags from a media, given the media node itself.

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:forEach var="tag" items="${media:tags(mediaNode)}">
        <c:out value="${tag}" />
      </c:forEach>
      
    

media:tagsLoc(info.magnolia.cms.core.Content, java.util.Locale)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String[] tagsLoc(info.magnolia.cms.core.Content, java.util.Locale)

Get the tags from a media, given the media node itself and a locale. Try to get the value from nodedata "tags-{locale}"; if not found get the value from "tags-en"; if not found again, get the value from "tags".

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:forEach var="tag" items="${media:tagsLoc(mediaNode, pageContext.request.locale)}">
        <c:out value="${tag}" />
      </c:forEach>
      
    

media:thumbnail(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String thumbnail(info.magnolia.cms.core.Content)

Get the url to the thumbnail (l100x100 resolution) for a given media node (image or flv/youtube preview)

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <img src="${pageContext.request.contextPath}${media:thumbnail(mediaNode)}" />
      
    

media:title(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String title(info.magnolia.cms.core.Content)

Get the title from a media, given the media node itself.

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:out value="${media:title(mediaNode)}" />
      
    

media:titleLoc(info.magnolia.cms.core.Content, java.util.Locale)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String titleLoc(info.magnolia.cms.core.Content, java.util.Locale)

Get the title from a media, given the media node itself and a locale. Try to get the value from nodedata "title-{locale}"; if not found get the value from "title-en"; if not found again, get the value from "title".

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:out value="${media:titleLoc(mediaNode, pageContext.request.locale)}" />
      
    

media:type(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String type(info.magnolia.cms.core.Content)

Get the media type for a given media node

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:if test="${media:type(mediaNode) eq 'image'}">
        <img src="${pageContext.request.contextPath}${media:url(mediaNode)}" />
      </c:if>
      
    

media:url(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String url(info.magnolia.cms.core.Content)

Get the url to the media, given the media node itself

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <img src="${pageContext.request.contextPath}${media:url(mediaNode)}" />
      
    

media:urlParams(info.magnolia.cms.core.Content, java.util.Map)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String urlParams(info.magnolia.cms.core.Content, java.util.Map)

Get the url to the media, given the media node itself and an options map

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <img src="${pageContext.request.contextPath}${media:url(mediaNode, optionsMap)}" />
      
    

media:urlres(info.magnolia.cms.core.Content, java.lang.String)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String urlres(info.magnolia.cms.core.Content, java.lang.String)

Get the url to the resolution for a given media node (image or flv/youtube preview) The resolution string has the following pattern [controlChar][width]x[height][;param_key1=param_value1,param_key2=param_value2,...] The controlChar identifies which resize method will be used:
  • o: makes the new image to fit into required res and fills empty areas with background color you pass to in "parameter" attribute as hex value of "background" parameter (i.e. paramters='background=FF67A5')
  • l : makes the new image to fit into required res
  • n : makes the new image to contain the required res
  • no control char : makes the new image to contain the required res and the crop the simmetric bands that outfit res

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <img src="${pageContext.request.contextPath}${media:urlres(mediaNode, "o200x300")}" />
      
    

media:usedInWebPages(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String[] usedInWebPages(info.magnolia.cms.core.Content)

Get list of path to content nodes of website repository in which the given media node is used

Example

      
      <c:set var="mediaNode" value="${media:node(content.image)}" />
      <c:forEach var="page" items="${media:usedInWebPages(mediaNode)}">
        <a href="${pageContext.request.contextPath}${page}">${page}</a>
      </c:forEach>
      
    

media:width(info.magnolia.cms.core.Content)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.Integer width(info.magnolia.cms.core.Content)

Returns the width of the *original* media, if available

media:url2(info.magnolia.cms.core.Content, java.util.Map)

Function class: net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl

Function signature: java.lang.String getUrl2(info.magnolia.cms.core.Content, java.util.Map)

@deprecated use urlParams()

<media:media>

Displays a media

Example

      
      <media:media id="myMedia" item="${content.image}"  />
      
    

<media:player>

Renders the audio or video player

<media:swfobject>

Renders the flash-content and the javascript for replacing it

Example

      
      <media:swfobject player="jwplayer5" width="${width}" height="${height}" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="${flashvars}" />