Get height and width of device and object

I want to make picture frame in studio, is have any way to keep the ratio between frame and device. How can i get height and with of device and object to calculate

@Seb shared a snippet here Device Using? to check screen aspect ratio but i have yet to figure out how to actually work with it because i get returned value 1 for the devices I’ve been testing (android and iphone)