Adobe CQ5.5-How to display Page Thumbnail using API -
i have configured image page using sidekick >page properties>images tab. want fetch page image(thumbnail) in 1 of jsp. can give me pointers or code snippet api class , method can use achieve this.
thanks, rajeev
i suggest using default image component example - /libs/foundation/components/image.
if you're putting code component specific page type though, code should this:
if (currentnode.hasnode("image")) { string imagepath = currentnode.getnode("image").getpath(); resource imageres = resourceresolver.getresource(imagepath); image = new image(imageres); image.loadstyledata(currentstyle); image.setselector(".img"); if (!currentdesign.equals(resourcedesign)) { image.setsuffix(currentdesign.getid()); } image.draw(out); }
keep in mind though, though set image, not mean show - if you're using default page dialog page properties, show broken image. that's because there bug in cq sling:resourcetype property of image doesn't set, , won't show up. because .img selector gets put on image doesn't know do, unless get's pointed resource type definition .img selector, can render image.
i've uploaded package can use hotfix issue default /libs/foundation/components/page component dialog, set resource type when upload image. can find/download package google drive
hopefully helps. let me know if need more help.
edit
if you're trying page properties image 1 page on page, need use resource resolver. should have 1 available in cq, code:
resource imageres = resourceresolver.getresource(pathfromyourdialog); image image = new image(imageres);
the rest same - you're giving different path start from.
Comments
Post a Comment