Quick PHP CI question. - 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: Quick PHP CI question. (/showthread.php?tid=53145) |
Quick PHP CI question. - El Forum - 07-12-2012 [eluser]theknight[/eluser] I have written the following segment of code in order to protect my images from being accessed directly. View: Code: <img src='<?php echo base_url(); ?>index.php/Controller/getImage/obama.jpg' width="100px"> Controller: Code: //function to protect images from being accessed directly. Anyway, I am not having any luck. It is returning a broken image, rather then the actual image itself. Why? All help appreciated. Thank you. Quick PHP CI question. - El Forum - 07-12-2012 [eluser]theknight[/eluser] Solved it, had to remove: if(file_exists($filepath)){ } I have no idea why it is screwing up with that, image should exist. Any ideas why? Quick PHP CI question. - El Forum - 07-12-2012 [eluser]TWP Marketing[/eluser] Just a guess, you are passing a URL to the file_exists() function. It needs a file path instead of a URL. |