I use the yii advanced template. I store the images in the root/public directory, because it will be an image intensive application. But I do not know how I can render out the image on the web page.
Your webserver is probably configured to route all requests to frontend/web/index.php. So to serve your image directory, you’d have to tell it to route specific requests to another directory.
<VirtualHost *:80>
ServerName myproject.dev/public
DocumentRoot "/var/www/html/myproject/public/"
<Directory "/var/www/html/myproject/public/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName myproject.dev
DocumentRoot "/var/www/html/myproject/frontend/web/"
<Directory "/var/www/html/myproject/frontend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
</Directory>
</VirtualHost>