Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php image adress

Status
Not open for further replies.

801119

Programmer
Apr 10, 2000
311
SE
Greetings all...

I have absolutly no idea what I'm looking for, then only thing I know is the "adress" part!
Code:
Lets say an image is located at: [URL unfurl="true"]http://www.internet.com/images/img.jpg[/URL]
and I want it to look like this when it opens:
[URL unfurl="true"]http://www.internet.com?img=img.jpg[/URL]

or <img src=&quot;[URL unfurl="true"]http://www.internet.com?img=img.jpg&quot;>[/URL]

if you understand what I'm after?!

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Well, perhaps what I want is for my php page to write the image directly through the code. I know I saw it somwehere, but not sure where. But can't really find it again o)

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Hmmm, are you looking for something like this?
Code:
$img = &quot;/images/&quot;;
$img .= $_GET['img'];

echo &quot;<img src=\&quot;$img\&quot; />&quot;;

Nothing else comes to mind. Hope it helps.
 
No, lets say that the images are outside of server-root and there fore not accessable for the webserver, so I need php to access them for me.

lets say server root is
C:/apache/and the images are locaed out side
C:/images/

Now the server can't acces them, right? So I need php to access them for me, so when a certain image is needed that I do not want the webserver to access, the php code will do it for me?

Any clearer, or am I as usual talking gibberish ;D

My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
You're clear.

The HTML will look something like:

<IMG src=&quot;/foo.php?imgname=bar.jpg&quot;>

And your script will stream out the image from somewhere outside your document root.

The &quot;gotcha&quot; is that you'll need two scripts: one to output the actual HTML of the page, the other to do the image streaming. Well, you could do it with one, but I recommend using two.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top