Image url in Blog's article

I am creating blog using Yii. I want it can put image in my articles. I want the article to find the pictures in folder wwwroot/images/stories. What should I do?

I’ve put fckeditor in the field “Article” to make it simple. But I don’t understand how to set the url of the image. I usually using Yii::app()->request->baseUrl to access the image,css or js in html

but that’s impossible to using baseUrl in this case, right?

I guess that is possible to use the baseUrl, the images are not in protected.




<img src="<?php echo Yii::all()->baseUrl?>/images/stories/<?php echo $imageFile?>">



If this images will be edited by users, I can advice to save like blob in database. I find it very confortable because allows to use foreign keys for delete images that refer to a deleted post.

You can publish the images with an appropriate action, maybe of post controller, and access like that:




<img src="<?php CHtml::encodeUrl(array('post/image', 'id'=>$imageId))?>">