Display image in Iframe

I want to display an image in an iframe on my webpage. However, the problem is that I cannot make it expand to 100% of its size.

I want to do the following.

  • Have an iframe on my webpage.
  • Calling an image inside an iframe.
  • Make the image expanded to full size and in response, the iframe allows me to scroll.
  • There are no scroll bars on my web page.

There is currently a code here:

echo"<iframe name='graph' id='graph' src=$image style='position:absolute; top:0px; left:0px; height:100%;width:100%'></iframe>";

What he does is that the iframe comes on top of my web page and still does not expand to 100%. If I remove the position: absolute instead of:

echo"<iframe name='graph' id='graph' src=$image style='top:0px; left:0px; height:100%;width:100%'></iframe>";

I get it so that it expands in width to 100%, but in terms of height it is only 3 pixels high, and for scrolling down it is a scroll bar.

, , , , . CSS, ...

, , , Firefox. iframe, . Chrome IE. ?

+5
7

.

<iframe frameborder="0" scrolling="no" width="100%" height="100%"
   src="../images/eightball.gif" name="imgbox" id="imgbox">
   <p>iframes are not supported by your browser.</p>
</iframe><br />


<a href="../images/redball.gif" target="imgbox">Red Ball</a><br />
<a href="../images/floatingball.gif" target="imgbox">Floating Ball</a><br />
<a href="../images/eightball.gif" target="imgbox">Eight Ball</a>
+4

JavaScript iframe iframe.

+1

CSS:

body, html {
   height:100%   
}
0

( div, , ), , , iframe. 100%.

0

, .

, . .

src iframe HTML body, . 100% / CSS.

0

, php GD...

$img_rsrc = imagecreatefromjpeg($path_to_image);
// or imagecreatefrompng, imagecreatefromgif, etc, depending on the type of your image
$height = imagesy($img_rsrc);
$width = imagesx($img_rsrc);
imagedestroy($img_rsrc);

iframe . , .

0

, 100% , DOM.. . http://api.fatherstorm.com/test/iframe.php

and http://api.fatherstorm.com/test/iframe2.php

for examples with embedded page (CNN) or image

-1
source

All Articles