how to use new image folder in cakephp
I have created a folder in app/webroot/
. for image placing. eralier by default img folder cantain image. which I have used some thing like this:
<?php
echo $html->image('foldopen.png',array('width'=>14,开发者_开发知识库'height'=>'10','alt'=>'open'));
?>
now I have created new image folder insted of img folder. how to use this?
use a slash at the beginning of the path. For example
echo $html->image('/images/foldopen.png');
Using the slash at the start is relative to the app/webroot directory
Just create your folder in webroot folder (test) and use like this:
echo $this->Html->image('/test/image.jpg');
I created one images folder in webroot dir. I used
$this->Html->image('../images/profile_image.jpg');
in my cakephp2.1 application. this worked for me.
or you can just change the App.imageBaseUrl
in app/Config/core.php
If you want to keep your $html->image() statements short and modify the default image route you could always override the default behavior of image() by altering the config/tags.php file.
more info on changing the tag output
精彩评论