perochak
(Amjad Mughal)
December 9, 2010, 9:16am
1
Hi all,
I want to publish images of my extension but I am unable to do that.
I have set
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$baseUrl = Yii::app()->getAssetManager()->publish($dir . 'assets',true);
but it does not work.
Please help me in this regard.
thanks
mdomba
(Maurizio Domba Cerin)
December 9, 2010, 9:33am
2
Maybe it’s obvious… .but have you checked that the value of $dir corresponds to the actual folder where you have those images
iivano71
(Igor Zg1987)
December 9, 2010, 4:28pm
3
Hi all,
I want to publish images of my extension but I am unable to do that.
I have set
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$baseUrl = Yii::app()->getAssetManager()->publish($dir . 'assets',true);
but it does not work.
Please help me in this regard.
thanks
Try this this works for me
$dir = dirname(__FILE__).'/assets';
$this->baseUrl = Yii::app()->getAssetManager()->publish($dir);
trejder
(Tomasz)
December 9, 2010, 10:16pm
4
Well, I’m using something like this:
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'source';
$this->baseUrl = Yii::app()->getAssetManager()->publish($dir);
And this surely works! It is not specially different than your code. Therefore, as mdoba advised you, I would check, if you have any files in your source dir or if it really exists, as it seems problem lies here.
jacmoe
(Jacob Moena)
December 9, 2010, 11:54pm
5
Just keep in mind that this requires that the directory in question is in the same directory as that FILE .
Not one up or one down.
Within the directory of FILE .
mdomba
(Maurizio Domba Cerin)
December 10, 2010, 7:49am
7
would be nice if you can write what was the problem and what have you changed for making it work… so that in the future users with similar problem can read your solution…
perochak
(Amjad Mughal)
December 10, 2010, 9:21am
8
Problem
Unable to publish the assets of the extension i.e. images.
Solution
The solution was posted by the Trejder. I just modified it a bit to make it working properly for my extension.
$dir = dirname(__FILE__).'/assets';
$this->baseUrl = Yii::app()->getAssetManager()->publish($dir);