1

Possible Duplicate:
how to hide the actual download folder location

I have an img folder in each of my view folders, e.g. views/Login/img/myImage.png.

To echo that out as the source for an image tag I have to declare the full path to the image file on the server i.e. localhost:/mysite/public_html/views/Login/img/myImage.png.

Is there anyway around this where I don't have to use the full path?

Community
  • 1
  • 1
imperium2335
  • 23,402
  • 38
  • 111
  • 190
  • What would you want to use? – N.B. Jan 03 '13 at 13:02
  • 2
    this has nothing to do with MVC nor with OOP. – tereško Jan 03 '13 at 13:06
  • You can use the relative path. This path depends on the folder where your webrootfolder is. E.g "/views/Login/img/myImage.png" Here's a Article about it: http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm – devOp Jan 03 '13 at 13:03
  • you could use mod_rewrite to rewrite the paths to the images to the actual image. The outside world will then never see the true path. – Jeffrey Jan 03 '13 at 14:11

1 Answers1

0

Using the answers of the following question:

Reading filesystem and returning it

You are able to make an image caller script in your website root which will read the image file and return it as image.

mysite.com/getImages.php?src=Login/img/myImage.png

In this script you will add the prefix of the URL to the src query string.

Community
  • 1
  • 1
SaidbakR
  • 13,303
  • 20
  • 101
  • 195