Retina images?

839 views
Skip to first unread message

Derek Skinner

unread,
Aug 13, 2015, 2:14:09 PM8/13/15
to Google Web Designer beta
Hey all!

Is there currently a way to detect when an ad is being served on a retina display and serve 2x images instead of normal 1x assets? 

I can currently do this in Flite and Celtra, but have not been able to find a way to do this in GWD.

Any help is greatly appreciated.


Valerio Virgillito

unread,
Aug 17, 2015, 4:31:37 PM8/17/15
to Google Web Designer beta
Hi Derek,

In the current release of GWD there isn't any UI or setting that will let you toggle an image (or other element) based on the current screen resolution (retina display). But there are couple different manual approaches that can be used in GWD to achieve the same effect. I would not recommend using media queries since the document will not be author-able with them. Instead I would suggest using some custom JavaScript:

1. Using code view you could paste a simple isRetina JavaScript method (lots of examples online) and then call this method in the pre-stubbed 'handleDomContentLoaded' method and replace the images 'source' attributes.

The 2 media attributes to be checked for this are
- min-resolution
- min-device-pixel-ratio

Hope this helps, and let me know if you have more questions.

Thanks,
Valerio.

Adam Gore

unread,
Aug 19, 2015, 12:44:03 AM8/19/15
to Google Web Designer beta
Derek did you get a solution?

Im not very good with javascript, it would be great to get some code examples.

Adam Gore

unread,
Aug 19, 2015, 1:04:28 AM8/19/15
to Google Web Designer beta
i put this - https://gist.github.com/kirkonrails/73fffc83943ad52b6fc0 inside 'handleDomContentLoaded' but it didnt work, i get a Uncaught TypeError: Cannot read property 'replace' of undefined.

Do you have any examples you could link me to?

Adam Gore

unread,
Aug 19, 2015, 1:15:51 AM8/19/15
to Google Web Designer beta
Could i just use a retina image, but halved in size? so my canvas is 320x50, but i just load one image (640x100) but its dimentions will be wdith:320px height:50px

so whoever gets it will only load the retina image but be at the same size.

?? Sorry to spam haha

David Edeburn

unread,
Aug 20, 2015, 3:14:43 PM8/20/15
to Google Web Designer beta
This is what I was thinking as well. GWD team will Adam's suggestion work for Doubleclick RM mobile ads? Would be a great solution to just bring in assets at double resolution and shrink them by 50% inside of GWD. 
Message has been deleted

d...@fancypantsgroup.com

unread,
Apr 9, 2018, 9:38:29 PM4/9/18
to Google Web Designer beta
waht if the image is a dynamic element
Reply all
Reply to author
Forward
0 new messages