HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Automatically resize image to browser window
Post new topic   Reply to topic    HTML Help Forum Index -> Images & Graphics
View previous topic :: View next topic  
Author Message
Giraf



Joined: 14 Nov 2008
Posts: 2

PostPosted: Fri Nov 14, 2008 12:15 pm     Automatically resize image to browser window Reply with quote

I would like to display photographs so that they fill as much as possible of the browser's window. If I specify dimensions on the IMG tag, some people see the picture with a lot of unused space around, and some must scroll to see all of it. Is this possible to achieve by a not-to-complicated HTML / Javascript programming?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8431
Location: Castle Pines North, CO USA

PostPosted: Fri Nov 14, 2008 12:46 pm     Reply with quote



There would be many problems with this. For example, even if you determine that my resolution is 1920X1200, I have Internet Explorer to display at 1280X1024 (which you cannot determine). And then if you try to enlarge an image based on resolution, it might become distorted.

So you could possibly use a pop-up to help create a specific window size. There are also some JavaScript codes like Auto-Sizing Image Popup Window Script (Automatically Sizes Popup Window to Image), Javascript Popup Image Window, or Cut & Paste JK Pop-up image viewer. Keep in mind some of these might not work on some browsers or browsers that have pop-ups blocked.

_________________
Corey
Toll Free Phone Numbers | Processing Credit Cards | Microsoft Expression Web Blog
Giraf



Joined: 14 Nov 2008
Posts: 2

PostPosted: Fri Nov 14, 2008 2:19 pm     Reply with quote

Thanks! As I suspected, there is no simple way. I was mainly thinking of the case where my picture is too big for the viewer's window. (Many new laptops have a rather low screen, and Windows' toolbars eat up some of it.) Making a pop-up solves the opposite problem. It seems best to specify reasonably small dimensions.
RushdenRotaract



Joined: 20 Dec 2008
Posts: 3

PostPosted: Sun Dec 21, 2008 2:44 pm     Reply with quote

you would be best using a specific size, what you could do is have it as big as possible and then force it to be smaller and link to a full version when you click on it, normally an image viewed on its own in a browser will get as big as it can without scrolling if its bigger than the window and only if you click o it it will become full size so that you have to scroll
thetermy



Joined: 23 Dec 2008
Posts: 4

PostPosted: Tue Dec 23, 2008 10:25 am     Re: Automatically resize image to browser window Reply with quote

Giraf wrote:
I would like to display photographs so that they fill as much as possible of the browser's window. If I specify dimensions on the IMG tag, some people see the picture with a lot of unused space around, and some must scroll to see all of it. Is this possible to achieve by a not-to-complicated HTML / Javascript programming?


Ignore this if it is unhelpful, but, are you looking for a percentage value?

Code:
<img src="yourimage.jpg" width="80%" height="50%">


You can set it within a table or just set it in a new window, with a percentage based width. The best way to maintain quality would be to upload a large image (1500x1500) so that it may be scaled down as apposed to stretched.

I hope this is helpful.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> Images & Graphics All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial