![]() |
File to Display image
So right now I'm working on some php so I can have <img src="http://www.philbon.com/getimage.php?id=3" /> that it will display the image based on the id. So far I have
[PHP]<? $id = $_REQUEST['id']; header('Content-Type: image/jpg'); echo file_get_contents("http://www.philbon.com/pictures/" . $id . ".jpg"); ?>[/PHP] When I go to http://www.philbon.com/getimage.php?id=3 it works just fine, but when i put the img tag in a webpage like: http://lucy.philbon.com it doesn't display the picture but instead just has spaces. I've tried it in both IE and FF and I get the same results. Can anyone help me out? Here is the code for http://lucy.philbon.com: [html] Programming Forums: The image tag is right under this:<br /> <img src="http://www.philbon.com/getimage.php?id=3" /> [/html] |
http://www.philbon.com/getimage.php?id=3 doesn't work for me.
|
Could you give me some feedback as to what is present?
What is the title? What is display? just a white page? What does the source look like? Are you pomted to download/save/open the file? What browser are you using? I think I might have to rethink this idea. Nevermind... I will Work on it later |
Worked for me once, but now it's not. Here's what I get from viewing the source:
Quote:
[edit:] That's on Firefox 1.5 |
Firefox 2.0 here:
Title :getimage.php Content on screen : http://www.philbon.com/getimage.php?id=3 After some time : the download window apears. Source code : :
<HTML>:
<br /> |
:
|
Quote:
Why not cut out the middle man and do this: [php] echo "<img src=\"http://www.philbon.com/pictures/" . $id . ".jpg\">"; [/php] btw, when coding in php, you don't need to worry about testing your php code on different browsers as php is server side only (unless you count php-gtk, but that's a different story). The only things you should be testing on different browsers is javascript/html/CSS etc... |
Quote:
You can use Apache to prevent this from happening: Rename getimage.php to getimage.jpg and upload a file named .htaccess to the same directory containing the following: :
<Files getimage.jpg> |
This is what I get.
http://www.daweidesigns.com/images/what.jpg |
It works for me at this point (Safari on a Mac). I suggest using the .htaccess technique I suggested so that all browsers will treat the file as a jpeg.
Out of curiosity, DaWei, if you load lucy.philbon.com in your browser, are the inline images displayed, or do you receive the same download prompt? |
| All times are GMT -5. The time now is 1:36 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC