使用存储在cakephp中webroot目录外部的图像显示用户配置文件的配置文件图片
问题描述:
I am trying to use CakePHP to output a user profile image just the same way as facebook outputs an individual's profile picture. The challenge i am having is that using $this->Html->image() automatically takes a picture from the webroot directory. My images are stored outside the webroot directory for security reasons. Using cakePHP sendFile or the deprecated media views bassically render the whole action as an image but i want the iamge to be output together with some user profile information. I tried to use the HTML tag with no success.
答
The Cakephp image helper statement is:
<?php echo $this->Html->image($path , $options = array()); ?>
this is a little exemple where i will be showing you how to use cakephp to show a external image:
<?php echo $this->Html->image('http://graph.facebook.com/100006760831116/picture?type=large' , array('class'=>'img-responsive' , 'width'=>'500', 'height'=>'500')); ?>