i have .png want embed on particular page. .png outside of web root, have module in our system allows users view image on separate page. found can use iframe view .png on browsers, there authorization issue or when trying print page image doesn't load through iframe. tried phps readfile(), have authorization issue. find authorization issue odd since 1 has logged in use our site @ all. best way imbed image?
<?php foreach($activity->getmedias() $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 not support iframes. please upgrade <a href="http://getfirefox.com">a modern browser</a>.</p> </iframe> solved code used work. using symfony 1.4.
<?php foreach($activity->getmedias() $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));?>">
sounds you're trying pass url readfile, e.g.
readfile('http://example.com/foo/bar'); this causes php start full-blown http request itself. need use local file-system path, e.g.
readfile('/path/outside/doc/root/to/the/image.png'); that's purely local filesystem operation, , not involve http layer @ all, bypassing entire document root/http authentication business.
Comments
Post a Comment