jcr path image variant

閲覧: 135 回
最初の未読メッセージにスキップ

ashilp...@gmail.com

未読、
2015/07/30 18:07:062015/07/30
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

未読、
2015/07/31 3:38:272015/07/31
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

未読、
2015/07/31 6:30:492015/07/31
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

未読、
2015/07/31 6:59:502015/07/31
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

未読、
2015/07/31 10:57:082015/07/31
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

未読、
2015/08/03 3:01:492015/08/03
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 />
 
メッセージは削除されました

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

未読、
2015/08/03 5:27:182015/08/03
To: Hippo Community
Thanks Bert and Mahesh - that works now.

Thanks
Ashil
全員に返信
投稿者に返信
転送
新着メール 0 件