![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Hobbyist Programmer
|
Here is an update: getimage.php
[php] <?php $path = "/home/philbon/public_html/pictures/" . $_REQUEST['id'] . ".jpg"; //$path = $_SERVER["DOCUMENT_ROOT"] . "/pictures/" . $_REQUEST['id'] . ".jpg"; header("Content-type: image/jpeg"); $fo = fopen($path, "r"); $img = fread($fo, filesize($path)); echo $img; ?> [/php] Here is a different version: getimagetn.php [php] <? $id = $_REQUEST['id']; header('Content-Type: image/jpeg'); echo file_get_contents("/home/philbon/public_html/pictures/tn/" . $id . ".jpg"); ?> [/php] Once again here is what is code for the site: [html] Programming Forums: The image tag is right under this:<br /> <img src="http://www.philbon.com/getimage.php?id=3" /><br /> <img src="http://www.philbon.com/getimagetn.php?id=3" /> [/html] Here are some links: http://lucy.philbon.com/ or http://philbon.com/lucy/ Webpage I'm wanting the pictures to be displayed on. http://www.philbon.com/getimagetn.php?id=3 file that is supposed to return the thumbnail of the image. http://www.philbon.com/getimage.php?id=3 file that is supposed to return the image. http://www.philbon.com/pictures/3.jpg Large image http://www.philbon.com/pictures/tn/3.jpg Thumbnail image @titaniumdecoy: Alright I've changed that so they are all relative. Even with the change I can't seem to get it to work @Pizentios: The reason I want to use the middle man is because the script will later be turned into one that would be used for different users or different areas of a website. For example I have Philbon.com and then I have Web.PhilBon.com and Lucy.PhilBon.com, what will happen is to set it up where I don't have to put in all the different image links: philbon.com/images/ or lucy.philbon.com/images, but they can be stored in one location with a database back end to help manage them all. Another would be like for different photo albums, I can have one main page that gathers images from different areas of the site just by having one main link. |
|
|
|
|
|
#12 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
@titanium: nope, I get a blank page and if I view source I get a blank page.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#13 | |
|
Programming Guru
![]() ![]() |
Quote:
thing is, with the code i posted, you could still have your database backend. Your way is good though as it's reuseable code (which is what php does best).
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
|
#14 |
|
Expert Programmer
|
I too would opt for PhilBon's method, as it doesn't require inline PHP to display the image(s).
Have you tried what I suggested? |
|
|
|
|
|
#15 |
|
Hobbyist Programmer
|
@Pizentios: Doh! What I ment was I have a database at Philbon.com, I have images at philbon.com/images/event1, philbon.com/images/event2, philbon.com/images/event3, philbon.com/images/event4. In the database it knows which event to go to. So when I call getimage.php?id=3, it will get the row in the table and use the url in that table to display the image. So I if I want a page that has 1 image from each event I only have to call getimage.php?id=3 for event 1, getimage.php?id=4 for event 2, getimage.php?id=5 for event 3 and getimage.php?id=6 for event 4. Does that help?
|
|
|
|
|
|
#16 |
|
Hobbyist Programmer
|
@titaniumdecoy: I did what you said on the htaccess, this is what it looks like
AddHandler application/x-httpd-php .shtml <Files 403.shtml> order allow,deny allow from all </Files> deny from 64.38.7.250 <Files getimage.jpg> ForceType application/x-httpd-php </Files> <Files getimagetn.jpg> ForceType application/x-httpd-php </Files> and then I put tried it on the website: http://lucy.philbon.com and http://philbon.com my getimage.jpg is the same as getimage.php which is posted above, and then getimagetn.jpg is the same as getimagetn.jpg |
|
|
|
|
|
#17 |
|
Expert Programmer
|
If you load getimage.jpg directly, it returns an Internal Server Error 500. My guess is your host has configured your Apache installation to disallow the use of <Files> tags. This works fine on my server, regardless.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OnlineTextEditor.Com! | Sane | Show Off Your Open Source Projects | 43 | Jun 16th, 2006 9:55 AM |
| outputting to a file to create a image | funkymp | C | 0 | Jan 16th, 2006 3:00 PM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 10:04 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 5:12 PM |
| Checking source codes of image, audio and video files | on_auc | C++ | 3 | Feb 21st, 2005 9:36 PM |