LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   make popup conform to image (https://www.linuxquestions.org/questions/programming-9/make-popup-conform-to-image-396978/)

bobbens 12-27-2005 05:50 PM

make popup conform to image
 
So i'm attempting to make the classic thumb sized image gallery that when you click on an image it opens up a pop up using that images size and then when you click on it it closes, thus you can quickly access and view the full sized image, yet i find out that when Firefox loads it up, it adds like 5 pixels of space to the top and left margins making it ugly, of course when you click and hold it, it will then center the image, making it fill it all up. The code is written in php which just outputs html/javascript:
Code:

function imageMakeThumb($image)
{
        global $THUMB_SIZE;
       
        $real_size = getimagesize($image);
        $size = imageScale($image, $THUMB_SIZE);
               
        return "<a href=\"javascript:void window.open('./image.php?img=$image', 'contWindow', 'width=$real_size[0],height=$real_size[1]');\"><img src=\"$image\" width=\"$size[0]\" height=\"$size[1]\" border=\"0\"></a>";
}

which then when generated on my site creates something like:
Code:

<a href="javascript:void window.open('./image.php?img=./projects/moo/images/atmaweapon.gif', 'contWindow', 'width=130,height=130');">
How can i get the window to load only the image and not add any "free" pixels on the side? I've tried using a table and then setting cellpadding and cellspacing to 1, also have tried using valign and <center> to attempt to fix it. Is there any way to fix this? I find it a really annoying problem. I've also gotten a friend to use IE on this and i get the same problem. It's strange. Any ideas?

EDIT: Damn got it working like 10 minutes after this post. Just kept on clicking links from my search, i guess i got lucky this time. Should spend more then 30 mins last time, altough from my point of view, every time i post i get it resolved, so maybe i should just post anyways just to get it working faster, even though i have to excuse myself for my hasty post. Oh well, if anyone is interested, check this link - > http://www.siteexperts.com/tips/html/ts02/page1.asp , basically just tells you to add a css style, and some parameters in the <body> to get it working.

paulsm4 12-27-2005 11:26 PM

I can't argue with the fact that it works, but unfortunately using deprecated attributes like "TOPMARGIN" probably isn't a good solution, either.

Please try something like this and see if it works:
Code:

// head stuff
<style type="text/css">
<!--
body {margin:0;padding:0;}
/* other style definitions */
-->
</style>

Here's the link I got it from:
http://www.zytrax.com/tech/css/workarounds.html

Very, very highly recommended book, if you're interested in pursuing CSS ... and need good, practical advise on how to try to write good, conformant CSS in a world full of totally nonconformant browers:

Professional CSS: Cascading Style Sheets for Web Design:
http://www.bookpool.com/sm/0764588338

bobbens 12-28-2005 03:33 AM

Quote:

Originally Posted by paulsm4
I can't argue with the fact that it works, but unfortunately using deprecated attributes like "TOPMARGIN" probably isn't a good solution, either.

Please try something like this and see if it works:
Code:

// head stuff
<style type="text/css">
<!--
body {margin:0;padding:0;}
/* other style definitions */
-->
</style>

Here's the link I got it from:
http://www.zytrax.com/tech/css/workarounds.html

Very, very highly recommended book, if you're interested in pursuing CSS ... and need good, practical advise on how to try to write good, conformant CSS in a world full of totally nonconformant browers:

Professional CSS: Cascading Style Sheets for Web Design:
http://www.bookpool.com/sm/0764588338

The thing about those deprecated attributes, is that if the browser is old, it's probably the only one that works. The main problem is that since this website is not for me, but for a friend, who gets views from all types of people, i'd like to get maximum compatibiility with all sorts of browsers, even though if the site was for me i wouldn't do all the crappy IE hacks you have to do to get it working in IE. With only the margin:0pt i can get it working in my browser (firefox 1.5), but since i'm not too sure about the more archaic ones, and i don't have any others, i can't test the CSS and see if it works everywhere.
I'm not too into CSS (only for practical use), because i enjoy more the PHP. I just know enough CSS, javascript and html to make things look ok, without being too fancy, but i have alot more fun in PHP, altough once i learn python i might start making sites in python :).
Well i am just tempted to say, "best viewed in anything not internet explorer" and just stop makeing stupid hacks for them. I probably will, why support things not standard and inferior? Thanks for the advice, i'll be taking out the obsolete tags now :) followed by all my hacks to attempt to find the width and height in all non-compliant browsers (which usually doesnt work anyways).

Man the posts i don't write in one sitting always seem less coherent ><.


All times are GMT -5. The time now is 05:23 AM.