I have an iframe that shows a picture generated by a software on the server. The image size is sent in pixels to the software by a parameter in the command line.
The iframe size is set relatively, using <iframe width="100%" >
, no problem with that. But in small screens, if the iframe gets smaller than the picture it causes a bad effect, with undesired scroll bars to show the hidden parts of the image.
Is there a way to know the size of the iframe in the browser, or the screen itself, so I can send the correct size to generate a picture that will fill properly in the iframe?
(I guess this is used by responsive themes)
EDITION: I'm reasking this in another way here How to make it sure that an iframe content fits it?
The best approach would depend on the method in which the image is loaded into the iframe. The size of the iframe would have to be determined on the client end, so it would be out of reach for PHP.
I'd personally load the image with PHP on the server end and avoid iframes. If you are loading the image after the page is loaded, you might want to reset the iframe's size using javascript(or jQuery).
If you could provide more detail about how the image is loaded into the iframe, it would help figure out what exactly you're looking for.