4 Replies Latest reply on Jun 17, 2013 10:40 PM by Veena_07

    How to access renditions for smartimage?

    Veena_07 Level 3

      Hi

       

           I want to drag and drop an available rendition for an image. How can i achieve this.? How can i access the renditions with all the features of smartimage ; say rotation, crop, resize etc...

       

       

       

      Thanks

       

      Veena

        • 1. Re: How to access renditions for smartimage?
          rush_pawan Level 4

          Hi Veena,

           

          I think there are multiple questions

           

          #  OOTB you can not drop a rendition (apart from original) of any image because the renditions are referenced copy of original image with set of extra property (like height, width etc...)

           

          # Not sure why you want to drop a specific rendition on component. if it's only to display that specific rendition on component then you can achieve it via dropping the original image and through code prepare a call to specific rendition

           

          For example: if you want to display a banner of /content/dam/geometrixx/banners/banner-mono.png with specific rendition of 140x100 the probably you have build the relative url as "/content/dam/geometrixx/banners/banner-mono.png/jcr:content/renditions/cq5dam.thumbnail. 140.100.png" whereas "/content/dam/geometrixx/banners/banner-mono.png" is your original image path you can get it from image node create inside the component and set as "fileReference" property & about height & width you can have custom size property similar to "image" component.

           

          # You can access other image properties like roation, crop from image node itself which has been created inside your component node on page. it sets these property with name 'imageRotate', 'imageCrop' correspondingly.

           

          I hope it clarifies your doubt. Let me know for more information

           

          Thanks,

          Pawan

          • 2. Re: How to access renditions for smartimage?
            Veena_07 Level 3

            Hi pawan

             

                  I tried the same. But it was not bringing my other image properties; Thats why.

             

            For eg:

             

             

            I tuk the rendition image and set it to my image object as

             

            image.setSrc(<rendition path>);

            As per my knowledge this image object will contain all my properties for rotation crop and all. But it is giving me the rendition without croping or rotation.

             

            If you try this you will come to know what i am actually trying to say.

             

            Looking forward to hear from you soon

             

             

            Thanks

             

            Veena

            • 3. Re: How to access renditions for smartimage?
              rush_pawan Level 4

              Hi Veena,

               

              I think you have mixed the answers i provided above as you have asked multiple questions. So here is some more detail

               

              1. When you crop/rotate or perform any other type of operation on image from component dialog it does not create a new rendition for image instead it sets those operations as property=value pair with image node (Do it by your self and check the properties set on image node as i mentioned above it sets these property with name 'imageRotate', 'imageCrop' correspondingly.)

               

              Now to retreive the same image how its appearing on your dialog after performing all the operation first you need to have image resource object. I hope you have as you mentioned in your reply. so now perform this (as example)

               

              Image image = new Image(resource);  //if you already have image object then this step not require

              image.addCssClass(DropTarget.CSS_CLASS_PREFIX + "image");

              image.loadStyleData(currentStyle);

              image.setSelector(".img"); // use image script

              image.setDoctype(Doctype.fromRequest(request));

              image.draw(out);

               

              you need not require to set image source path to rendition path because you already have image object which has been built upon those set properties\

               

              2. The rendition path will be used only when you have proper rendition available for that image and that time you will use

              image.setSrc(<rendition path>);

               

               

              For reference you can look at /libs/foundation/components/image component and try to use it.

               

              I hope it helps you.

               

              Also let me know if your earlier post related to path field did not work out http://forums.adobe.com/message/5380319#5380319

               

              Let me know for more information.

               

              Thanks,

              Pawan

              • 4. Re: How to access renditions for smartimage?
                Veena_07 Level 3

                Hi pawan,

                 

                 

                        The issue here is , I want the rendition image to be displayed with all the image properties, suppose author has rotated it; i want the rendition image also to be rotated. Its not acheivable with above method.

                 

                 

                Also the path field problem ; i didnt get time to check wince we tuk another approach. I will be checking it soon and will let you know soon

                 

                 

                Thanks

                 

                 

                Veena