Access Images Outside Of Protected

Hi,

I currently have some images stored in protected/data/service/. I now need to be able to serve this via the web, so I decided to move them to the <webroot>/images folder.

That solved one problem, but how do I access them in the filesystem? i.e.

i.e. before i could do:


			$imageFile = Yii::app()->basePath . Yii::app()->params['IMAGES_SERVICE_DIR_PATH'] . $id . '.jpg';

			if (is_file($imageFile)) {

Given that the images are now in <webroot>/images/service, I could probably do something using Yii::getPathOfAlias(‘application’), but I was hoping for a more elegant solution.

Anyone got any ideas?

You could try this one


Yii::getPathOfAlias('webroot.images.service');


$imageFile = dirname(Yii::app()->basePath) .DIRECTORY_SEPARATOR."images".DIRECTORY_SEPARATOR. $id . '.jpg';

                        if (is_file($imageFile)) {

Get the root directory path and append the rest images directory path to it.

use Yii::app()->baseUrl.’/images/something.jpg’;