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.
1条回答 默认 最新
- douzhao2047 2014-10-15 13:34关注
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')); ?>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报