PDA

View Full Version : Lightwindow 2.0 Resize to iFrame Content Problem



daemonhunt
05-09-2011, 10:35 PM
Hi there

Lightwindow 2.0 is integrated into my DAM site smoothly and I am currently using it to open an internal PHP page via a Lightwindow iFrame.

This iFrame page contains PHP logic that shows an image or not depending on the level of access. Those without the correct access see a watermarked image which is swapped out dynamically, or they are kicked out if they don't have any access.

Lightwindow is apparently able to resize an iFrame automatically to content (which is why I use it), however it is not sizing properly on the first click of the preview link, unless (it seems) the image in the iFrame is already cached.

So, it only works perfectly the second time you click for the larger preview, but never on the first (unless you have recently clicked it).

Please see: eSpace Digital Asset Management System (http://e-stream.co.nz/resourcespace/?c=1&k=8e33f36f21)

To recreate the issue, you may choose any image from the "lightbox" at the bottom of the window, then either click directly on the preview image that loads in the top frame (or click "view" by the preview link) to view the larger preview that I want displayed in a Lightwindow.

I have been trying to figure out the Java code, however I am not a Java programmer and fail to see what is happening. I have tried pre-loading the iFrame, but not really sure what I am doing. I also thought perhaps it was the order that Lightwindow is loading the javascript data that could be the problem (i.e. loading the lightwindow size before loading the image on the page), but I am unsure what to move where in the lightwindow.js file if this is indeed what is happening.

The images in the iFrame are sized dynamically by the system to be no more than 700px wide or 700px high depending on their type. You will see an audio link there which contains album art which is probably the minimum size of an image in the system. This dynamic php-imagemagick resizing means that I cannot possibly set a fixed frame size that comfortably frames each image without forcing a 700px x 700px window size (which I think is also not an elegant solution). The page that loads in the iFrame is relatively complex, so it is not as simple as just loading an image-based lightwindow instead of "page".

Can anyone help me? I have actually added the js file into my DAM (as a text file) so you may analyse it, because it looks as if this post has a hard limit on the amount of characters it may contain LOL