Q:

Detect device screen size in craft cms

How can I get the screen size in craft cms? I mean the device width in px, so for example I can get a static map image with the exact size to fit the device screen

A:

I think you are going to struggle with this in Craft, you would need to do it through Javascript.
Craft runs off PHP which is a server side scripting language, you need a client side scripting language.
Here is a good question which should help you with this: Get the size of the screen, current web page and browser window

