I know this is all to complex, but at that time I was not able to find a simple 
solution which supports all the dynamic: same content can be rendered 
differently: for instance if the vertical navigation is shown the main images 
must be smaller. Anyway I plan to add a section to the stk book to explain all 
that in details.

I changed the ImageModel so that it checks for a imageVariation paramter first. 
This allows you to configure the imageVariation if you don't need the dynamic 
resolving. Will go into STK 1.3.

Note: to get the original you can call asset.getVariation("original"). An 
option in your case would be to suclass imageMode and override the 
getImageVariation() method.

Patch:

Index: 
src/main/java/info/magnolia/module/templatingkit/paragraphs/ImageModel.java
===================================================================
--- src/main/java/info/magnolia/module/templatingkit/paragraphs/ImageModel.java 
(revision 31870)
+++ src/main/java/info/magnolia/module/templatingkit/paragraphs/ImageModel.java 
(working copy)
@@ -84,6 +84,11 @@
     }
 
     public String getImageVariationName() {
+        String variationName = (String) 
definition.getParameters().get("imageVariation");
+        if(StringUtils.isNotEmpty(variationName)){
+            return variationName; 
+        }
+
         final Site site = STKUtil.getSite(content);
         final ImagingSupport imaging = site.getTheme().getImaging();
         String cssSelector = 
CssSelectorBuilder.getInstance().createCssSelector(this);


 
On 15.02.2010, at 10:18, Ernst Bunders wrote:

> 
> Thanks Matteo
> 
> You point out the blindingly obvious. Should have thought of that myself :-)
> 
> One remark about the code example:
> model.getImage() already returns a variation based on the whole
> cssClass resolving stuff, but StkUtil.getAssetVariation() expects an
> original variation. It works ok, because AssetWrapper.getVariation()
> delegates this call to the asset that it wraps, but all the stuff that
> model.getImage() does is unnecessary, and it's a pity you can't get
> the original asset from ImageModel.


> 
> Thanks,
> 
> Ernst
> 
> 
> 2010/2/12 Matteo Pelucco <[email protected]>:
>> 
>> Ernst Bunders ha scritto:
>>> 
>>> Hello
>>> 
>>> I'm in the process of creating some custom imaging variations for
>>> paragraphs we have developed. I'm using the imaging module, and so I
>>> have to create css selectors that will match some css rule.
>>> 
>>> I find this rather hard.
>> 
>> I strongly agree with you.
>> It is better and more "agile" to build image variations "name-based".
>> You can simply say
>> 
>> [#assign imageLink = stk.getAssetVariation(model.image, "primoPiano").link]
>> 
>> where "primoPiano" is an imageVariation node name.
>> 
>> 
>> the problem is that model.image will produce some error message in
>> catalina.out. (I am on 4.1.1)
>> 
>> HTH,
>> Matteo
>> 
>> 
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
>> 
>> 
> 
> 
> 
> -- 
> Ernst Bunders
> Ontwikkelaar VPRO
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to