Screen Size to adjust an image?
It's possible to detect the browsers screen resolution and adjust an image according to the results?
Thanks.
It's possible to detect the browsers screen resolution and adjust an image according to the results?
Thanks.
Abhishek Reddy posted this at 08:41 — 28th November 2003.
He has: 3,348 posts
Joined: Jul 2001
Check these out:
from irt.org
http://tech.irt.org/articles/js035/index.htm#4
http://developer.irt.org/script/285.htm
http://developer.irt.org/script/1166.htm
(related)
javascriptkit
http://javascriptkit.com/script/cut135.shtml
http://javascriptkit.com/script/cut12.shtml
(related)
You can spin a script together that adjusts your image height with something like document.images['myimage'].width = screen.width * (factor_of_screen_width)
Busy posted this at 09:10 — 28th November 2003.
He has: 6,151 posts
Joined: May 2001
just remember a lot of people disable javascript because of pop ups etc so don't rely on it
JeevesBond posted this at 11:15 — 28th November 2003.
He has: 3,956 posts
Joined: Jun 2002
I haven't looked...But do the scripts take account of resizing windows, maximising, different browsers DOM's?
...Just some considerations for you
Abhishek Reddy posted this at 20:35 — 28th November 2003.
He has: 3,348 posts
Joined: Jul 2001
Yep. For active resizing, you'll want to call the function every x milliseconds to update your data. DOMs are a little trickier -- iirc, NS uses screen.availWidth whereas IE uses screen.width, so you'd have to write for both.
Although Suzanne is correct, I might add that resizing bitmaps per window area can work if it is used reasonably (not active resizing, only check onLoad). In this case, one could use GD or similar to resize the image for possibly improved quality. Still won't be terribly efficient, though.
Suzanne posted this at 16:45 — 28th November 2003.
She has: 5,507 posts
Joined: Feb 2000
For reference, allowing the browser to adjust the image will universally result in poor results if the image is a bitmapped image. If it's a vector image (Flash, et cetera), then the technology that displays them will adjust the images correspondingly without you needing to do anything.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.