Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 4th, 2007, 2:51 PM   #11
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
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.
PhilBon is offline   Reply With Quote
Old Jan 4th, 2007, 2:54 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
@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
DaWei is offline   Reply With Quote
Old Jan 4th, 2007, 2:55 PM   #13
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
Originally Posted by PhilBon View Post
Here is an update: getimage.php
@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.


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!
Pizentios is offline   Reply With Quote
Old Jan 4th, 2007, 2:57 PM   #14
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 841
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
I too would opt for PhilBon's method, as it doesn't require inline PHP to display the image(s).

Quote:
Originally Posted by PhilBon View Post
Even with the change I can't seem to get it to work
Have you tried what I suggested?
titaniumdecoy is offline   Reply With Quote
Old Jan 4th, 2007, 3:01 PM   #15
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
@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?
PhilBon is offline   Reply With Quote
Old Jan 4th, 2007, 3:11 PM   #16
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
@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
PhilBon is offline   Reply With Quote
Old Jan 4th, 2007, 3:20 PM   #17
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 841
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
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.
titaniumdecoy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
outputting to a file to create a image funkymp C 0 Jan 16th, 2006 2:00 PM
After execution - Error cannot locate /Skin File? wchar Visual Basic 1 Mar 5th, 2005 9:04 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM
Checking source codes of image, audio and video files on_auc C++ 3 Feb 21st, 2005 8:36 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:38 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC