CodeIgniter Forums

Full Version: Image Source
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]RogerM[/eluser]
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?

Thanks

El Forum

[eluser]TheFuzzy0ne[/eluser]
It could be any one of many reasons.

Does this work(?):

Code:
<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.

El Forum

[eluser]RogerM[/eluser]
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)

Thanks.

El Forum

[eluser]Dam1an[/eluser]
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?

El Forum

[eluser]RogerM[/eluser]
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.