NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: jkunes on May 06, 2009, 02:22:46 PM

Title: Display resolution and image size
Post by: jkunes 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
Title: Re: Display resolution and image size
Post by: Bruce 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
Title: Re: Display resolution and image size
Post by: Alberto 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
Title: Re: Display resolution and image size
Post by: jkunes on May 07, 2009, 09:01:13 AM
Hi Bruce,

Thanks.  That works very well and so easy!

Cheers,
Jill