php - Laravel3: Giving failsafe image paths with built-in functions of Laravel -
background-image: url('home_assets/images/origami/parallax/01.png'); <img alt="" src="home_assets/images/origami/logo.png">
i worry 404 issues if:
- i move laravel folder subfolder,
- rename home_assets in future
i'm looking solution like:
url::to_home_assets_image('origami/logo.png');
url
take care of paths. if move laravel a/b/c/
folder, should understand public folder should in a/b/c/public/
.
::to_home_assets_image
should work constant. home_assets_image
constant/function/object (whatever want call as) should refer 'home_assets/image/'
.
something this: url::to_home_assets_image('origami/logo.png');
should work.
what think? worry or has done avoid folder issues?
ps: can't use html::image()
. break first example cause add tag.
you can achieve you're after <img src="{{url::to_asset('images/original/logo.jpg')}}">
. more work urls in css styles, technically posible. however, assuming assets stored in /public
, url('../images/image.ext') work fine. if need change asset folder path, can set asset_url
config variable in /application/config/application.php
.
Comments
Post a Comment