loading images in browser - 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: loading images in browser (/showthread.php?tid=21222) |
loading images in browser - El Forum - 08-03-2009 [eluser]Unknown[/eluser] I can't load my images from my root directory ,what is the problem ? loading images in browser - El Forum - 08-03-2009 [eluser]skunkbad[/eluser] show some code, and we can probably help loading images in browser - El Forum - 08-03-2009 [eluser]Unknown[/eluser] <img src="<?=base_url()?>?images/2.jpg" border="0" /> loading images in browser - El Forum - 08-03-2009 [eluser]Zeeshan Rasool[/eluser] I think there is an error in this code. You are using ( base_url()? )it like passing a param to a php page. You should use ... Code: <?=base_url()?> images/2.jpg OR (if you haven't any '/' in the end of baseURL ,then) Code: <?=base_url()?> / images/2.jpg loading images in browser - El Forum - 08-03-2009 [eluser]skunkbad[/eluser] you probably need to output a surrounding image tag. Code: <?php loading images in browser - El Forum - 08-04-2009 [eluser]richthegeek[/eluser] *drumroll* Code: <?php echo site_url("/images/2.jpg"); ?> ta-da! loading images in browser - El Forum - 08-04-2009 [eluser]wiredesignz[/eluser] Rich are you drunk? Code: <?php echo site_url("/images/2.jpg"); ?> //produces: http://domain.tld/index.php/images/2.jpg Its not even an image tag or a link. loading images in browser - El Forum - 08-04-2009 [eluser]richthegeek[/eluser] lol, not drunk, just tired. I always (always always always) have mod_rewrite going on so my site URL has no index.php in it. And OP's question wasn't really about producing a tag, just a good URL. |