Package com.day.cq.wcm.foundation

Examples of com.day.cq.wcm.foundation.Image


            ServletException, IOException {

        final String transformName = PathInfoUtil.getSuffixSegment(request, 0);
        final NamedImageTransformer namedImageTransformer = this.namedImageTransformers.get(transformName);

        final Image image = this.resolveImage(request);
        final String mimeType = this.getMimeType(request, image);
        Layer layer = this.getLayer(image);
       
        // Transform the image
        layer = namedImageTransformer.transform(layer);
View Full Code Here


                rendition = asset.getOriginal();
            }

            final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());

            final Image image = new Image(resource);
            image.set(Image.PN_REFERENCE, renditionResource.getPath());
            return image;

        } else if (DamUtil.isRendition(resource)
                || ResourceUtil.isA(resource, JcrConstants.NT_FILE)
                || ResourceUtil.isA(resource, JcrConstants.NT_RESOURCE)) {
            // For renditions; use the requested rendition
            final Image image = new Image(resource);
            image.set(Image.PN_REFERENCE, resource.getPath());
            return image;

        } else if (page != null) {
            if (ResourceUtil.isA(resource, NameConstants.NT_PAGE)
                    || StringUtils.equals(resource.getPath(), page.getContentResource().getPath())) {
                // Is a Page or Page's Content Resource; use the Page's image resource
                return new Image(page.getContentResource(), "image");
            } else {
                return new Image(resource);
            }
        }

        return new Image(resource);
    }
View Full Code Here

        // load background image from docroot
        Component c = WCMUtils.getComponent(ctx.resource);
        Layer bg = ImageHelper.createLayer(c.getLocalResource("background.png"));

        // load additional image
        Image image = new Image(ctx.resource);
        image.setItemName(Image.NN_FILE, "image");
        image.setItemName(Image.PN_REFERENCE, "imageReference");
        Layer img = image.getLayer(false, false, false);
        if (img != null) {
            img.setX(bg.getWidth() - img.getWidth());
            img.setY(bg.getHeight() - img.getHeight());
            bg.merge(img);
        }
View Full Code Here

  }

  @Override
  public Object mapResourceToField(Resource resource, ValueMap valueMap, Field field, String propertyName) {
    Class<?> targetClass = field.getType();
    Image image = new Image(resource, propertyName);
    if (targetClass.isAssignableFrom(Image.class)) {
      return image;
    } // else

    if (targetClass.isAssignableFrom(String.class) && (image != null) && image.hasContent()) {
      image.setSelector(".img");
      return image.getSrc();
    } // else

    return null;
  }
View Full Code Here

TOP

Related Classes of com.day.cq.wcm.foundation.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.