jcr path image variant

135 views
Skip to first unread message

ashilp...@gmail.com

unread,
Jul 30, 2015, 6:07:06 PM7/30/15
to Hippo Community
Hi

I'm trying to use the below as a component parameter to select an image:

@Parameter(name = "logo")
  @JcrPath(
    pickerSelectableNodeTypes = {"hippogogreengallery:imageset"},
    pickerInitialPath = "/content/gallery/logos"
  )
  String getLogoPath();

My question is, is it possible to reference a particular image variant (e.g. thumbnail) in the path? It currently just returns the path without referencing any variant i.e. the original image.

Thanks
Ashil

Bert Leunis

unread,
Jul 31, 2015, 3:38:27 AM7/31/15
to hippo-c...@googlegroups.com
Hi Ashil,

On Fri, Jul 31, 2015 at 12:04 AM, <ashilp...@gmail.com> wrote:
Hi

I'm trying to use the below as a component parameter to select an image:

@Parameter(name = "logo")
  @JcrPath(
    pickerSelectableNodeTypes = {"hippogogreengallery:imageset"},
    pickerInitialPath = "/content/gallery/logos"
  )
  String getLogoPath();
Try using a specified picker for images in this annotation. See [1] for more info. I think that when you use

pickerConfiguration = "cms-pickers/images"

you get a picker like when you pick images in a rich text field, where you can choose the variant in the bottom of the picker dialog. Can you see if that works? I didn't try it out.
 

My question is, is it possible to reference a particular image variant (e.g. thumbnail) in the path? It currently just returns the path without referencing any variant i.e. the original image.

Thanks
Ashil

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

a.p...@loyalty.co.uk

unread,
Jul 31, 2015, 6:30:49 AM7/31/15
to Hippo Community, b.le...@onehippo.com
Hi Bert

I tried the pickerConfiguration - this only limits the type of document you can pick, it doesn't let me chose a variant. It's always a particular image variant I want if that helps...

Thanks
Ashil

Mahesh Acharya

unread,
Jul 31, 2015, 6:59:50 AM7/31/15
to hippo-c...@googlegroups.com, b.le...@onehippo.com
Hi Ashil

In the rendering template (i.e., freemarker or jsp) you explicitly reference a variant by its name.
for example,  if your "document" object contains "image"  you can do the below to access "thumbnail"  variant in freemarker template.

<@hst.link hippobean=document.image.thumbnail/>

This will give you the context path to the image variant "thumbnail"

Hope this helps.

Mahesh


--
Mahesh R. ACHARYA
Solution Architect | Mobile: 781-640-5559Email: m.ac...@onehippo.com
Boston -  745 Atlantic Ave, Suite #703, Boston, MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
http://www.onehippo.com/

a.p...@loyalty.co.uk

unread,
Jul 31, 2015, 10:57:08 AM7/31/15
to Hippo Community, b.le...@onehippo.com, m.ac...@onehippo.com
Hi Mahesh

This works if i'm referencing an image which is part of the document bean, but for an image I've added as a component parameter I can't seem to access any of the variants.

Thanks!
Ashil

Bert Leunis

unread,
Aug 3, 2015, 3:01:49 AM8/3/15
to Hippo Community
On Fri, Jul 31, 2015 at 4:57 PM, <a.p...@loyalty.co.uk> wrote:
Hi Mahesh

This works if i'm referencing an image which is part of the document bean, but for an image I've added as a component parameter I can't seem to access any of the variants.

If you have only the repository path to a node that you want to use in the site, you have to retrieve the bean yourself, for example like this;
final Object logo = RequestContextProvider.get().getObjectBeanManager().getObject(logoPath);
request.setAttribute("logo", logo);

Then you can use the logo bean as Mahesh mentioned:
<@hst.link hippobean=logo.thumbnail />
 
Message has been deleted

a.p...@loyalty.co.uk

unread,
Aug 3, 2015, 5:27:18 AM8/3/15
to Hippo Community
Thanks Bert and Mahesh - that works now.

Thanks
Ashil
Reply all
Reply to author
Forward
0 new messages