CodeIgniter Forums
Hi guys, its my first day. And i dont know how to link an image using CI. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Hi guys, its my first day. And i dont know how to link an image using CI. (/showthread.php?tid=65754)



Hi guys, its my first day. And i dont know how to link an image using CI. - socrats - 07-20-2016

Hello, i am using codeigniter for first time and i am trying to use any images, but i think there is a problem with folder permissions or something because links seems to be ok, but when i try to open the web page there are not images.

Could anyone help me a little to start with codeigniter?


RE: Hi guys, its my first day. And i dont know how to link an image using CI. - mwhitney - 07-20-2016

Generally, I'll put all images, CSS, JavaScript, etc. in a series of sub-folders under my public directory (/public/assets/images/, /public/assets/css/, etc.), then use site_url('assets/images/imagename.jpg') or base_url() . 'assets/images/imagename.jpg' in my img element's src attribute. You could also use the HTML helper's img() function: echo img('assets/images/imagename.jpg');