h3rm
1
Hi… 
i have class in components directory:
* components
- lang.php // php class
- flags // directory
> eg.png
> id.png
i want to load image from flags directory through lang.php, i tried like this:
CHtml::image('/flags/id' .'.png')
but failed, how the solution to this case ?
thank you
gusnips
(Gustavo)
2
$imagePath=Yii::getPathOfAlias('application.components.flags');
$baseUrl = Yii::app()->assetManager->publish($imagePath);
echo CHtml::image($baseUrl.'/eg.png');
echo CHtml::image($baseUrl.'/id.png');
h3rm
3
thank work well.
what if the file is already in publishing. whether he published it again or not ?
gusnips
(Gustavo)
4
great
it checks the modification date if its a file, and if higher than the published date, it overrides, if not it will just return the baseUrl
if its a folder, for performance reasons it just checks if the folder exist, so when developing, its safe to use like this
$baseUrl = Yii::app()->getAssetManager()->publish($basePath, false, -1, YII_DEBUG);
the last parameter refers to forceCopy, that will republish even if its already published
more info
http://www.yiiframework.com/doc/api/1.1/CAssetManager#publish-detail
h3rm
5
thank gustavo
means I do not worry if you use an asset, because it will not overload the server performance.