CodeIgniter Forums
Cannot display images in CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Cannot display images in CodeIgniter (/showthread.php?tid=88055)

Pages: 1 2 3


RE: Cannot display images in CodeIgniter - InsiteFX - 07-14-2023

You cannot load images from the project folder it is .htaccess protected.

Code:
<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

This is where you should be loading your resources.

PHP Code:
<?= $this->extend('layouts/default'?>



RE: Cannot display images in CodeIgniter - ilkin - 07-15-2023

Thanks. But how can I load images and CSS this way?


RE: Cannot display images in CodeIgniter - InsiteFX - 07-15-2023

Check out IncludeBeer's Web Site and look at his 4 part Creating a multilingual website with CodeIgniter 4
Start with 1 and work through to 4 look at how he is doing the layouts and templates.

IncludeBeer - Creating a multilingual website with CodeIgniter 4


RE: Cannot display images in CodeIgniter - kenjis - 07-16-2023

By the way, what web server do you use? Apache?
And where is the document root?

Doesn't the docs help you?
https://codeigniter4.github.io/CodeIgniter4/installation/running.html


RE: Cannot display images in CodeIgniter - ilkin - 07-18-2023

Yes, Apache. This is exactly what I was looking for! Thanks!