NetTalk Central

Author Topic: Display resolution and image size  (Read 3507 times)

jkunes

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Display resolution and image size
« on: May 06, 2009, 02:22:46 PM »
Hi All,

I would like to change the size of an image (in a browse table) based upon the client's display resolution settings.  Anyone know an easy way to do this? First I must get the settings from the client's machine.  I think I can do that in JavaScript but I am not sure how to then use the values within my NetTalk app.

Thanks for any help you can give me.

Jill

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Display resolution and image size
« Reply #1 on: May 06, 2009, 10:15:33 PM »
If you add the following html to a NetWebPage, then the screen width, and screen height of the remote _screen_ will be sent to the server, and will be stored in Session variables for that user.

<script>
SetSessionValue('screenheight',screen.height);
SetSessionValue('screenwidth',screen.width);
</script>

Note that JavaScript is case sensitive, so you need to use the right case for (the JavaScript function) SetSessionValue.

In the templates, wherever you set an image, you also can set the height, and width, of the image. Use the sessionValues in a calculation there to determine how big you want the image to be displayed as.

Note this is the _screen_ width and height, not the _browser_ width and height. However for targeting mobile devices they are probably the same thing.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Display resolution and image size
« Reply #2 on: May 07, 2009, 02:33:58 AM »
Hi Jill,

Had you found a way to maintain the _ratio_ of the image in the browse?

Thanks
Alberto
-----------
Regards
Alberto

jkunes

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: Display resolution and image size
« Reply #3 on: May 07, 2009, 09:01:13 AM »
Hi Bruce,

Thanks.  That works very well and so easy!

Cheers,
Jill