I have a .png that I want to embed on a particular page. This .png is outside of the web root, but we have a module in our system that allows users to view that image on a separate page. I found that I can use an iframe to view the .png on some browsers, but sometimes there is an authorization issue or when trying to print the page the image doesn't load through the iframe. I tried PHPs readfile(), but then I just have another authorization issue. I find the authorization issue odd since one has to be logged in to use our site at all. What would be the best way to imbed this image?
<?php foreach($activity->getMedias() as $media_count => $media):
<iframe id="content" src="http://www.mysite.com/media/view/id/<?php echo $media->getId(); ?>" frameborder="0" style="width: 100%; height:825px;" seamless="seamless">
<p>Your browser does not support iframes. Please upgrade to <a href="http://getfirefox.com">a modern browser</a>.</p>
</iframe>
SOLVED This is the code I used to get it to work. I am using Symfony 1.4.
<?php foreach($activity->getMedias() as $media_count => $media):
$dataString=sfConfig::get('sf_root_dir').'/media/'.$media->getLocation(); ?>
<img SRC="data:image/png;base64,<?php echo base64_encode(file_get_contents("../../../../../..".$dataString));?>">