10 Replies Latest reply on Jun 21, 2013 6:56 AM by Jörg Hoh

    how to get the local file system path of an image that loaded into the image component in cq5?

    CQNewBie1 Level 1

      Hi,

       

      I'm having hard time uploading image from filesystem where as drag and drop works.

       

      I'm not getting a path of image selected from filesystem.

       

      here is my code..

       

      private String populateImage() throws Exception {

                          if (currentNode != null && currentNode.isNode()) {

                                         Node ImageNode = JcrResourceUtil.createPath(currentNode, "image",

                                                                            null, "nt:unstructured", true);

       

                                         imageUrl = ImageNode.hasProperty("fileReference") ? ImageNode.getProperty("fileReference").getValue().getString() : "";

             imageUrl = imageUrl.trim();

              log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE IF IS: " + imageUrl);

                          } else {

                                              imageUrl = properties.get("fileReference", "");

                                              imageUrl = imageUrl.trim();

                                              log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE ELSE IS: " + imageUrl);

                          }

       

       

                          return imageUrl;

                }

       

       

      So if I drag and drop..

      ImageNode.hasProperty("fileReference") is returning a valid path

      but if I upload an image  it is returning Null.

      So how to get the path? any suggestions around would be appreciated...