Image Uploading and Retrieving

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image Uploading and Retrieving

ramandeep0015
Hi

I wnat to upload the image and then display it in Jsp

I have created the image in Content repository using the following code

Node image = rootNode.addNode(name, "hippo:handle");
        image.addMixin("hippo:hardhandle");
        image.addMixin("hippo:translated");

        Node innerImage = image.addNode(name,"test:imageset");
        innerImage.setProperty("hippogallery:filename", name);
        innerImage.setProperty("hippo:availability", new String[] { "live",
                "preview" });
       
        Node thumbnail = innerImage.getNode("hippogallery:thumbnail");
        thumbnail.setProperty("jcr:data", stream);
        thumbnail.setProperty("jcr:mimeType", mimeType);
        thumbnail.setProperty("jcr:lastModified", Calendar.getInstance());


and then i linked the image to document
using the following code
Node imageNode = photos.addNode("test:images",
                "test:images");
        Node imageOne = imageNode.addNode("test:image",
                "hippogallerypicker:imagelink");
        imageOne.setProperty("hippo:docbase", imageUUID);
        imageOne.setProperty("hippo:facets", new String[0]);
        imageOne.setProperty("hippo:values", new String[0]);
        imageOne.setProperty("hippo:modes", new String[0]);

i am uploading the images to the gallery first and then linking it to the document using the docbase property

Now i want to display the image in jsp
Is there any way to find the URL to the image in Gallery Using the UUID of the image or name of the image

So that i can put that URL in src attribute of the image tag and get the image

Thanks & Regards
Ramandeep Singh
Ard
Reply | Threaded
Open this post in threaded view
|

Re: Image Uploading and Retrieving

Ard
On Sat, Mar 3, 2012 at 9:00 PM, ramandeep0015 <[hidden email]> wrote:

> Hi
>
> I wnat to upload the image and then display it in Jsp
>
> I have created the image in Content repository using the following code
>
> Node image = rootNode.addNode(name, "hippo:handle");
>        image.addMixin("hippo:hardhandle");
>        image.addMixin("hippo:translated");
>
>        Node innerImage = image.addNode(name,"test:imageset");
>        innerImage.setProperty("hippogallery:filename", name);
>        innerImage.setProperty("hippo:availability", new String[] { "live",
>                "preview" });
>
>        Node thumbnail = innerImage.getNode("hippogallery:thumbnail");
>        thumbnail.setProperty("jcr:data", stream);
>        thumbnail.setProperty("jcr:mimeType", mimeType);
>        thumbnail.setProperty("jcr:lastModified", Calendar.getInstance());
>
>
> and then i linked the image to document
> using the following code
> Node imageNode = photos.addNode("test:images",
>                "test:images");
>        Node imageOne = imageNode.addNode("test:image",
>                "hippogallerypicker:imagelink");
>        imageOne.setProperty("hippo:docbase", imageUUID);
>        imageOne.setProperty("hippo:facets", new String[0]);
>        imageOne.setProperty("hippo:values", new String[0]);
>        imageOne.setProperty("hippo:modes", new String[0]);
>
> i am uploading the images to the gallery first and then linking it to the
> document using the docbase property
>
> Now i want to display the image in jsp
> Is there any way to find the URL to the image in Gallery Using the UUID of
> the image or name of the image

Make sure that you fetch the jcr node belonging to the uuid. Then in
your jsp, you can use:

<hst:link var="imgSrc" node="${yourNode}"/>

<img src="${imgSrc}"/>


Thus, in words: Make sure you get the jcr node and aks a link from the
hst link tag

Regards Ard

>
> So that i can put that URL in src attribute of the image tag and get the
> image
>
> Thanks & Regards
> Ramandeep Singh
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/Image-Uploading-and-Retrieving-tp7340616p7340616.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html