コード例 #1
0
 private String getTumbnailUrl(
     HttpServletRequest request, HttpServletResponse response, CMVisual mediaItem) {
   CMPicture picture = mediaItem.getPicture();
   if (picture != null) {
     Blob blob = picture.getTransformedData(IMAGE_RATIO);
     if (blob != null) {
       return createUrlForTransformedBlob(
           blob, request, response, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
     }
   }
   return null;
 }
コード例 #2
0
  private MediaContent createPictureEnclosure(
      HttpServletRequest request, HttpServletResponse response, CMPicture mediaItem)
      throws URISyntaxException {
    request.setAttribute(NavigationLinkSupport.ABSOLUTE_URI_PARAM_NAME, true);

    Blob imageBlob = mediaItem.getTransformedData(IMAGE_RATIO);
    if (imageBlob != null) {
      String url =
          createUrlForTransformedBlob(imageBlob, request, response, IMAGE_WIDTH, IMAGE_HEIGHT);
      if (url != null) {
        MediaContent mediaContent =
            createMediaContent(request, response, url, mediaItem, imageBlob);
        mediaContent.setHeight(IMAGE_HEIGHT);
        mediaContent.setWidth(IMAGE_WIDTH);
        return mediaContent;
      }
    }
    return null;
  }