Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set size of servlet generated image to match size of browser window

 
Barron Greig
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I have a servlet that generates JPEG with hardcoded dimensions. What I'd really like though is to somehow pass details of the browser window width and height to the servlet so that it generates an image exactly that size. Also, if the user resized the window, then I'd send back a new image with the correct dimensions.
Any ideas how I'd do this?
Thanks in advance,
Barry
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you would have to use JavaScript to get the screen height and width and incorporate that information in the URL for the image. Looking at this JavaScript Pocket Reference I just got, that looks like screen.availHeight and screen.availWidth (but it has been some time since I wrote any Javascript)
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic