One way to do this with minimal code at resize time is to manipulate the style rule for a class that is used by every image.  I haven’t tried this, and this is something I’ve only read the documentation for:

 

  1. Set a class on each image you want to resize together
  2. On initialize, enumerate the document.stylesheets array and for each sheet, the cssRules array to find a cssRule with a selectorText of the class you set in 1
  3. On resize, change the width and height of the cssRule returned in 2 (To get the resize from the middle effect, also set the top and left properties appropriately (set the position property in (1) for this to work))

 

I think the entire cssText of the cssRule must be set, so I would keep this class to only the information needed to do the cool resize.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Duffield
Sent: Tuesday, January 31, 2006 9:23 AM
To: Timo Hoepfner
Cc: [email protected]
Subject: Re: [Rails-spinoffs] resizing multiple images usinggetElementsByClassName

 

Cool, thanks, but they are just doing a while loop aswell. And as for a iPhoto like scale they are missing it a bit. In his (her?) example the images all scale up to the top left, but in iPhoto, the images scale from there center, until there is enough room for one more or one less column. (Take a look in my example I posted)

 

However that site did point out a bug in Mac Firefox that is probably responsible for some of the stuttering I am seeing as I am using Mac Firefox. It runs a lot smother in Safari and I tested it in IE Windows and the scaling was fairly smooth, but I wil need to do a test and see how it works with 100+ images..

 

I acutely switched over to using ".each" instead of the while loop and I "Think" it is a little better, but I know that Thomas Fuchs is doing the same sort of thing in fluxiom (http://www.fluxiom.com) and based on the video clip there he is getting WAY better performance than the method I am doing...

 

Any how, if any one can offer some advice on optimizing this I would be for ever in your debt!

 

Cheers.

______________________________________________________________________

Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com

 

 

 

On 31-Jan-06, at 12:43 AM, Timo Hoepfner wrote:



Hi Alex,

 

I cannot help you with the details, but here's a description on how to do iPhoto like image resizing with scriptaculous:

 

 

Hope this helps,

 

Timo

 

 

Am 31.01.2006 um 05:23 schrieb Alex Duffield:



I am building a iPhoto like (Read rip-off) interface for thumbnails and I am having a couple problems that I thought some one on the list might be able to assist me on ...

 

first off here is the page: http://v4.incontrolsolutions.com/galltest/

 

 

 

 

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to