"CAssetManager is a Web application component that manages private files (called assets) and makes them accessible by Web clients. "
But a simple image is private file? o for show simple image i have to use /protected/myfolder?
i try to use CAssetManager, and i save the image in /protected/myfolder, and save with CAssetManager in Assets, and retrieve the link for show my image.
But whenever i reload the page, or upload the new image, Yii create a new folder with the same file in assets…Can i create the folder only when i upload a new image??
/protected/upload is not good place for images you wish to show on page. ‘protected’ directory should be protected from direct web access and by default it is protected by .htaccess configuration. Rather put your files in /upload (where / is the root application directory with index.php).
you should use AssetManager when you develop Widget or other component which requires js/css/image files. Such component is placed in protected folder without direct access and you have decision: to put those static files in public directory, but then they will be in other disk location and such component will be hard to reuse in other project (you have to remember to copy all files from other locations and even remember what are those locations: /css, /js, /images, etc…) or you can keep static files near component class (in subdirectory for example) but you need to serve them somehow to end users when component is used on page. In this second case you use AssetManager to publish (copy) static files from directory protected from direct access to the public asset folder.