CodeIgniter Forums
Image Source - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Image Source (/thread-18261.html)

Image Source - El Forum - 04-30-2009

Hi everyone,

I would like to hide the source urls for my images on a proofing site. I have seen it done this way before and I am not sure how to get it to work in Codeignitor:

< img src="image.php?test.jpg" />

I can't get it to work with a controller in codeignitor.

I tried:

< img src="/getimage/test.jpg" />

and this won't route it to the controller, all it get a is a broken link.
In the controller I get the path to the image, and the image and then return that value.

Any thoughts?


Image Source - El Forum - 04-30-2009

It could be any one of many reasons.

Does this work(?):

<img src="&lt;?php echo site_url('getimage/test.jpg');?&gt;">

Going to that URL directly in your browser should give you an error message or something.

Image Source - El Forum - 04-30-2009

ok. I tried that. still nothing.

How should the controller output the image? Should i just echo the location or echo the photo itself?

If i go to the URL it gives me an echo of the file location (thats what I have it doing now)


Image Source - El Forum - 04-30-2009

Are you trying to hide the location of the images on the server? Caus you don't want people to know your file structure? You could probably do some htaccess trickery?

Image Source - El Forum - 04-30-2009

Yes that is the main reason I am doing it. Also, the client requested that it be this way. I have never done it this way before.

Should the controller return the image or the location?

I tried to return the file path, and that didn't work either.

Thanks for the help.