icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » In need of PHP help

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old October 28th, 2007, 9:31 AM   #1 (permalink)
wgm
Registered User
Super #1
 
Joined in Mar 2005
Lives in Washougal, WA
1,306 posts
Gave thanks: 23
Thanked 39 times
In need of PHP help

What I like to do is have photos like:
/photos.php?id=(number)
/thumbs.php?id=(number)

http://www.wmcintosh.com/gallery.php

Code used for above link...
Code:
<?php 

include('/home/xxxxxx/public_html/sources/config.php');
if(!isset($_GET['id'])){
include('content/gallery/' . '0.php');
}else{
if(file_exists('content/gallery/' .$_GET['id'] . '.php')){
include('content/gallery/' . $_GET['id'] . '.php');
}else{
echo 'Sorry, could not find the <strong>id=' . $_GET['id'] . '</strong> page.';
}
}

?>
Tried to modify same code for what I used on link above, but it must involve more then I expect, right now my photos are missing as seen here http://www.wmcintosh.com/gallery.php?id=4

Photos (fullsize and thumbs) will reside in 2 different directories, if I could get help for one of them, surely I could manage the other one.

Would appreciate any assistance, thanks.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 28th, 2007, 5:54 PM   #2 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
165 posts
Gave thanks: 22
Thanked 18 times
Quote:
Originally Posted by William View Post
What I like to do is have photos like:
/photos.php?id=(number)
/thumbs.php?id=(number)

http://www.wmcintosh.com/gallery.php

Code used for above link...
Code:
if(file_exists('content/gallery/' .$_GET['id'] . '.php')){
include('content/gallery/' . $_GET['id'] . '.php');
Okay, here is what springs to my mind about this code...
The /gallery/[number].php file: what is in that file exactly? If it is a php file "returning" an actual jpg file then it has to have an header("Content-type: image/jpg");
line somewhere in the file (along with a few other lines as well to make it work). This file would be used in the <img> tags "src" attribute - instead of 1.jpg you have gallery.php?id=1 which appears to be how the page on the link you posted has been used.

Hope this leads you in the right direction....

Cheers
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 28th, 2007, 7:33 PM   #3 (permalink)
wgm
Registered User
Super #1
 
Joined in Mar 2005
Lives in Washougal, WA
1,306 posts
Gave thanks: 23
Thanked 39 times
Thanks for responding jdcopelin.

Sorry for your time, going back to .html pages, besides my site is only personal and doesn't warrant .php pages, perhaps another time, especially when I know more PHP, right now have other projects that need my attention.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 29th, 2007, 5:20 PM   #4 (permalink)
wgm
Registered User
Super #1
 
Joined in Mar 2005
Lives in Washougal, WA
1,306 posts
Gave thanks: 23
Thanked 39 times
Well, as posted on DSL Reports webmonks forum I deleted all .html files and kept all .php files, but the photo part can wait till I learn more, I did copy jdcopelin post for reference.

Was inspired to keep playing and learning PHP, mind you I am learning on my own.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 30th, 2007, 4:59 PM   #5 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
165 posts
Gave thanks: 22
Thanked 18 times
Quote:
Originally Posted by William View Post
Well, as posted on DSL Reports webmonks forum I deleted all .html files and kept all .php files, but the photo part can wait till I learn more, I did copy jdcopelin post for reference.

Was inspired to keep playing and learning PHP, mind you I am learning on my own.
I'm finding that learning PHP is a bit tedious - it is difficult at first sight to know if a script is "written properly" (as regards to code efficiency or security). At the moment I just use the PHP manual for reference and then just use google to look for basic concepts of what it is I am trying to do. Just wish I had more time to play with PHP...

Cheers
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 31st, 2007, 1:19 AM   #6 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,540 posts
Gave thanks: 69
Thanked 33 times
My friend Julie has a very small PHP script that does exactly what you're looking for. It requires just a tiny bit of tweaking, but she has it well labeled. Worth checking out if you want a simple gallery.
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks ceo for this great post!
wgm (October 31st, 2007)
Old October 31st, 2007, 10:23 AM   #7 (permalink)
wgm
Registered User
Super #1
 
Joined in Mar 2005
Lives in Washougal, WA
1,306 posts
Gave thanks: 23
Thanked 39 times
Quote:
Originally Posted by ceo View Post
My friend Julie has a very small PHP script that does exactly what you're looking for. It requires just a tiny bit of tweaking, but she has it well labeled. Worth checking out if you want a simple gallery.
Tried it and is quite simple/nice, but the photos show up randomly, would like to have them separate (ie: Southern Washington Cascades photos by them self on a page, and so on with 3 other categories).

Don't take it as bad, its quite opposite.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 31st, 2007, 8:11 PM   #8 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,540 posts
Gave thanks: 69
Thanked 33 times
Quote:
Originally Posted by William View Post
Tried it and is quite simple/nice, but the photos show up randomly, would like to have them separate (ie: Southern Washington Cascades photos by them self on a page, and so on with 3 other categories).

Don't take it as bad, its quite opposite.
Hmm, well with Captivate you'd have to name your images in such a way that it'll display them how you want. When I used it for a screencap archive, I just named everything in order. But yeah, to do what you're asking it'd probably be better to use something a bit more sophisticated rather than create a bunch of folders and stuff.

No prob, sorry it didn't work for you -- I'll keep my eyes peeled for something else.
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On