Hi Alex,

Your image preloader approach worked superbly. I'm now able to scale my
images to fit within the image cell -- and I didn't even have to subclass
qx.ui.embed.Gallery! Mucho thanks for this.

Best,
Dalmazio




Alexander Back wrote:
> 
> Hi Dalmazio,
> 
> see my comments below.
> 
> Dalmazio Brisinda wrote:
>> However, on your second point -- this is part of the problem I'm having.
>> The
>> width and height attributes are not actually being used in the Gallery
>> Widget. Looking more closely at the source for the Gallery widget we have
>> the following in createImageCell():
>> 
>> inode.width = d.thumbWidth + 2;
>> inode.height = d.thumbHeight + 2;
>> 
>> It looks as if the width and height properties (assigned to d.width and
>> d.height) are entirely unused in the Gallery widget. That the img element
>> width height properties are being assigned the value of the thumbWidth
>> and
>> thumbHeight properties. I'm thinking that this might have been
>> unintentional, but I'm not sure. But I can deal with this by subclassing
>> and
>> changing the functionality.
> Yes you are right, these values are not used by the gallery widget. 
> However, if you subclass the gallery widget you can use them and as the 
> data structure is a map you can also easily add additional fields 
> without breaking the existing
> functionality.
> 
>> But even more importantly, even if I subclass the Gallery widget to
>> actually
>> use the supplied width and height properties, where do I get the *actual*
>> width and height of the image just loaded, so I can pass correct width
>> and
>> height info to the Gallery widget? This information doesn't seem to be
>> readily available anywhere. It almost seems like I need to load the image
>> first (perhaps in an invisible iframe?) then get the x and y dimensions,
>> then load the image again in the visible gallery with the now known x and
>> y
>> dimensions. Not sure about this though. Any thoughts on this?
> 
> You can use the preloader manager of qooxdoo to achieve this.
> 
> --snip--
> var preloader = 
> qx.io.image.PreloaderManager.getInstance().create("http://YOUR-IMAGE-URL";);
> preloader.addEventListener("load", function(e){
>    // "this" refers to the preloader object
>    // -> http://demo.qooxdoo.org/current/apiviewer/#qx.io.image.Preloader
> 
>    var height = this.getHeight();
>    var width  = this.getWidth();
>   });
> --snip--
> 
> This way qooxdoo is preloading the image and you can get the width and 
> height infos from the preloader and add then the right values to the 
> gallery.
> 
> Hope this helps,
>    Ale
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Loading-images-with-original-dimensions-in-qx.ui.embed.Gallery-%280.7.3%29-tp584208p641110.html
Sent from the qooxdoo mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to