> > > Robin van Meteren <[EMAIL PROTECTED]> wrote: > > Recently we implemented some functionality that > retrieves the width and > > height of images in mmbase. Although other solutions may > already exist we > > thought this might be interesting to some of you. > > That seems a very usefull addition. > > > In order to retrieve these properties from an image > we've used ImageInfo, > > a freely available java class, downloadable at: > > > http://www.geocities.com/marcoschmidt.geo/imag> e-info.html. > Imageinfo is > > used by the added > ImageBuilder class, which introduces to new virtual > > fields to an image node, width and height. This class > has to be defined in > > the image builder configuration file like this: > > > <classfile>nl.kennisnet.cpb.cloud.builders.ImageBuilder</classfile> > > > > As an example of how this could be used, consider a > neatly fitting image > > popup without whitespace around the image. The jsp code > looks something > > like this: > > <mm:node number='<%=imageNumber%>'> > > <a href="imagePopup.jsp?id=<%=imageNumber%>" > > onClick="NewWindow(this.href,'_blank','<mm:field > > name='width()'/>','<mm:field > name='height()'/>','no');return false;" > > target="_blank"> > > </mm:node> > > Using 1.7 This could of course also be done with <mm:function > name="width" /> > > > > > Using these extra virtual fields one can also size an > image using the > > width and height attributes within the HTML image tag, > provided that no > > scaling is taking place using a template attribute. > > Why not? A scaled images is yet another image, so why can the > tool not be used on the icache-node then? > The width and height are determined from the byte array in the handle field from the image itself. I am not sure but I think the byte array for the icache-node is stored in a different node. This node should than be first retrieved.
> I would like to add this functionality to 'the' image builder > itself. Perhaps as an optional plugin (<property > name="imageinfoclass" or so). > > Michiel > That would be nice. Robin
