开发者

Is it possible to access an external asset directory with the CakePHP Image helper?

My CakePHP Folder Structure

   1. app / webroot / img
   2. cake开发者_C百科
   3. vendors
   4. assets

<?php echo $html->image('cake_logo.png', array('alt' => 'CakePHP'))?>

Is it possible to access my external asset directory with the CakePHP Image helper?


I've never tried this, but I believe that Cake relies on the web server to serve up image assets by default. This would suggest that, no, you can't move your images outside of your web root and still use the HTML helper's image() method.

You can, however, use media views to send binary information to users. It works outside of the core helpers, but might meet your needs.


Try to go up the directory by adding ../ at the front of image file as many times as it is necessary like this:

echo $html->image('../../special_assets_folder/cake_logo.png');

That worked for me in some cases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜