On 1/8/07, Duncan Webb <[EMAIL PROTECTED]> wrote:
Chandan Pitta wrote:
> On 1/7/07, Duncan Webb <[EMAIL PROTECTED]> wrote:
>> Chandan Pitta wrote:
>>> On 1/5/07, Duncan Webb <[EMAIL PROTECTED]> wrote:
>>>> Chandan Pitta wrote:
>>>>> What happened to the images? The pop-up window shows only scaled
>>>>> image. I see that the javascript for openfoto has changed and is
>>>>> causing the browser to scale the image. Can someone take a look at it.
>>>>> Is it part of a larger fix that is coming later?
>>>> I had to commit Wout's patches otherwise your patches will not succeed,
>>>> there need to be a fix here.
>>> I see. Is Wout fixing this issue? I can take a look at it otherwise.
>> Wout has provided a patch this has fixed the problem :)
>
> Good! Thanks Wout.

Not perfect, the window needs closing otherwise the next image clicked
reuses the window but doesn't resize it.


Ok, finally I was able to get to this issue. Fixes are as follows:

1. If the pop-up window is already open it will be resized to fit to
the new image.
2. If the image is larger than the screen, then the window is
maximized to the screen and the image is scaled to fit inside it. No
scrollbars.
3. Previous patch caused the image to change aspect when the image
does not fit in the screen. I fixed it such that the image scales
while maintaining aspect.
4. Brings the window into focus (useful in case it is not closed
between clicks).

Please check the patch and commit.

Thanks
Chandan




>> I do have a problem with the naming of the scaled images, the normal
>> freevo convention is to simple add the same path as the overlay path to
>> the image. The problem is that we lose the path information so it is not
>> possible to delete cached thumbnails when the image has been deleted.
>>
>> Will it be a problem if the part after root dir is a path?
>
> I think I did not understand the root dir part properly. I see what
> you mean when you say that we lose the path information. I am guessing
> that you want to create the same path structure in
> /var/cache/freevo/images (or whatever the config variable is set) as
> the original image. That will work. No problem.

That's what I thought, just wanted to check

Thanks
Duncan


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Index: src/www/web_types.py
===================================================================
--- src/www/web_types.py        (revision 8954)
+++ src/www/web_types.py        (working copy)
@@ -443,25 +443,62 @@
         self.res += """<script language="JavaScript" type="text/javascript" 
style="display:none;">
         var width = 0;
         var height = 0;
-        var max_width = screen.width - 100;
-        var max_height = screen.height;
+        var max_width = screen.availWidth;
+        var max_height = screen.availHeight - 50;
+        var client_width = 0;
+        var client_height = 0;

         function openfoto(loc,width_img,height_img){
             width = width_img;
             height = height_img;

             if (width >= max_width || height >= max_height) {
-                scrollbars = 'yes';
                 getNewSize();
             }
-            var 
params="toolbar=no,location=no,status=no,menubar=yes,resizable=no,scrollbars="+scrollbars+",top=0,left=0,width="+width+",height="+height;
+            var 
params="toolbar=no,location=no,status=no,menubar=yes,resizable=no,top=0,left=0,width="+width+",height="+height;
             foto = 
window.open("fileinfo.rpy?img="+loc+"&w="+width+"&h="+height,"Images",params);
+
+            // Some funky code here
+            // 1. First we resize the window to the size we want
+            // 2. Calculate the client area of this resized window
+            // 3. Subtract the client area from the actual size
+            // 4. Add the difference to the window size
+
+            // Step 1. First we resize the window to the size we want
+            foto.resizeTo(width, height);
+
+            // Step 2. Calculate the client area of this resized window
+            if (parseInt(navigator.appVersion) > 3) {
+                if (navigator.appName=="Netscape") {
+                    client_width = foto.innerWidth;
+                    client_height = foto.innerHeight;
+                }
+                if (navigator.appName.indexOf("Microsoft") != -1) {
+                    client_width = foto.body.offsetWidth;
+                    client_height = foto.body.offsetHeight;
+                }
+            }
+
+            // Step 3. Subtract the client area from the actual size
+            var diff_width = width - client_width;
+            var diff_height = height - client_height;
+
+            // Step 4. Add the difference to the window size
+            foto.resizeBy(diff_width, diff_height);
+
+            foto.focus();
         }

         function getNewSize(){
-        //this is not correct!
-            height = Math.round(height * (max_width / width));
-            width = Math.round(width * (max_height / height));
+            // recalculate width / height maintaining aspect
+            if (max_width / max_height > width / height) {
+                width = Math.round(max_height * width / height);
+                height = max_height;
+            }
+            else {
+                height = Math.round(max_width * height / width);
+                width = max_width;
+            }
         }
         </script> """


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to