![]() |
Image folder - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Image folder (/showthread.php?tid=8725) |
Image folder - El Forum - 05-29-2008 [eluser]MrSmith[/eluser] Hi everybody, I am very new in CodeIgniter. I write a simple webpage and then I confuse how to show images in my web page. I want to create image folder to keep all of images that use to show in the webpage.Where is path in CodeIgniter folder that I should create this folder and how to insert the image to webpage. Thank you Image folder - El Forum - 05-29-2008 [eluser]EthanSP[/eluser] [quote author="MrSmith" date="1212058900"]Hi everybody, I am very new in CodeIgniter. I write a simple webpage and then I confuse how to show images in my web page. I want to create image folder to keep all of images that use to show in the webpage.Where is path in CodeIgniter folder that I should create this folder and how to insert the image to webpage. Thank you[/quote] You create the [images] folder on your [codeigniter] folder, same level as your [system], [user_guide], etc. folders. You put this script in a php file $this->load->view('foo.jpg'); to view a particular image. You put the said php file under the [views] folder within your [system]/[application] folder. Image folder - El Forum - 05-29-2008 [eluser]poji23[/eluser] For me I'm not sure if it's good practice but what I do is I create the images folder on the same level as the system folder, and in my views, if I wish to insert the image I use: <images src='<?=base_url();?>images/pic.gif' /> I think you could also load the image with: Code: $image_properties = array( Image folder - El Forum - 05-29-2008 [eluser]MrSmith[/eluser] If I use CSS to load images to webpage like this : Code: body{ How can I custom css to refer to the right path of image file. Image folder - El Forum - 05-29-2008 [eluser]Michael Wales[/eluser] Quote:How can I custom css to refer to the right path of image file. It would be the same as always - a relative path to the image, from the CSS file. For me, folder structure is: |system |webroot |-application |-assets |--images |--css So, in a view file, I use: Code: <img src="<?php echo base_url(); ?>assets/images/logo.png" /> In CSS: Code: background:url(../images/logo.png); |