Results 1 to 5 of 5

Thread: Need Help with browser resizing

  1. #1
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help with browser resizing

    I am trying to make a new website and what I want to do is showcase graphics.

    I want to have thumbnail images on the main page...I want those images linked to open full size in a new browser window...so basic html code <a href="link" Target="resource window"><img src="img.gif"> no problem what I am wanting is the new browser window not to be a full sized window but a specified size window which I also know how to do via java script...however I would like for the new browser window to autofit to content...meaning to open at different sizes depending on the size of the image/content etc...

    I know by most people this is considered not good web design...but I want to do it anyways...its only my personal site and for the most part those who dont like my web design can not visit my site LOL...but I want to do it just because I dont know how...you know, learn something new LOL.

    Anywho, I have searched the web and can not find anything...the only "auto fit to content" stuff I can find is of course for tables withing a page...is this possible? If so can you help me.

    ---More Info---

    I know how to actually get a new browser window to open...what I want is the main page to only show the thumbnail images...then when you click on the thumbnail I want the full sized picture to open in the new browser however I only want that window to be the size of the full sized image...in other words...if the picture is 300x300 I only want the window to be 300x300...but I dont want to have to specify the size in the link to every single picture as they are all different sizes...I want the browser window to be smart enough to know to only open up the size of the picture no matter what size the picure is ie: auto fit to content. Does that make sense?

    ---More Info---

    I found this to try and help explain what I want to do...most of the time when you are specifing a browser window size...you do so by using the following java script....

    <html>
    <head>
    <title>homepage</title>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval = window.open(URL, 'name', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=250');
    eval.moveTo(5,5);
    }

    // End -->
    </script>
    </head>
    <body>

    <a href="javascriptopUp('myportfolio.htm')">My portfolio</a>

    </body>
    </html>


    so in the code above...the part that is in red I want to not have to specify a certain pixel width but rather have some sort of auto fit to content command there...that way you dont get a full browser window just one big enough to view the graphic...without scrolling or alternatly having a lot of wasted space that has no content.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,134
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    This cannot be done in any workable large-scale way that wouldn't have problems with large images and with small screens. In theory, you can preload all of your images, make sure they are preloaded before popping them up and reading their dimensions from the cache.

    This approach breaks down on slower connections if there are a large number of images or if any one of them are large files with a lot of bytes in it. Add to this the fact that you cannot pop up a window larger than the screen on most modern computers and that with smaller screens you would most likely be trying to do this. On older computers, you could open the window larger than the screen but, that's no good either.

    On the other hand, if you have a limited number of images and none of them are either to big graphically, or by the number of bytes involved, you could. But, at that point, why not just pass each new window the proper dimensions for each image?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well...most of the images that I am wanting to do this with are not very big...the largest maybe being 500x500...so I dont think it would cause any problems with small screen unless of couse someone were viewing via cellphone...which I dont really see happening. Also there are over 50 images that I am wanting to do this with so I dont want to have to take the time to write the dimensions different for every single image...I just want the browser to be smart enough resize itself as needed you know what I mean. Thank you very much for you input though I do appreciate it. I heard that it might be possible with a cgi script but I have no expirience with cgi with perl or anything and I dont see any open source scripts that would accomplish this...any ideas?

    Thank You

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,134
    Thanks
    44
    Thanked 3,231 Times in 3,192 Posts
    Blog Entries
    12

    Default

    Without going into all of the details, this probably could be done using server side code like that (cgi or Perl). I have seen PHP and asp/VBasic (both also server side) code that can get an image's dimensions. I have even used the latter to do this (get an image's dimensions). However, it can be even slower than getting the dimensions on the client side, depending upon server load. If you were to have the server do this this operation periodically and keep a record of the dimensions it finds in a database or in cache, this really could work out fairly well. But, it would never be as fast or as seamless as simply supplying the dimensions yourself in the code.

    How this would be worked out on any given server would almost certainly have to be custom tailored to that server's environment. I could be wrong about this last part. If I am, you could find plug and play scripts for this, written in one or more of those server side languages just by using Google.

    Where you might find something like this that is more or less 'ready to go' would be in a CMS (content management system). Even there, it would have to be a CMS that could run on your server and you would probably need to learn how to get it to do this particular set of operations. Be especially aware that not all CMS could do this anyway, not by a long shot.

    One thing I am fairly sure you haven't considered is that by using javascript and batch programming (I've only done this on a Windows based PC) you can get a locally run browser working with the images on the same local machine to write out your code for you, complete with the dimensions required. Once again though, this would be a custom job but, the only criteria for customization would be the kind of client side code that you would need outputted by this procedure.

    Information on and examples of this last approach are on display in this thread:

    http://www.dynamicdrive.com/forums/s...ad.php?t=13488
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Just wanted to say thanks for all the help...I guess I will just have to manually place the dimensions per picture...knowing me...and obviously Im lazy lol...Ill just leave it to a full browser window Thanks for everything, you guys are great!!!

    Smile
    Crystal

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •