#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    3
    Rep Power
    0
    I want to create a photo album of images that are indexed in the database but the actual images reside in another folder. I am able to query the database for things like catalog number, title, etc. But I haven't figured out a way to (when I look at the online PHP documentatiom, I go loopy) get the images from that folder and display them on the results page.
    Ideally, I would love to have a search result of thumbnails with links the the larger photos.
    Anyway, any assistance would be appreciated.
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    Directory Strucrure:

    -doc_root (script here)
    |
    -images (full size images here, maybe with subdirectories)
    |
    -thumbs (thumbnails here)

    With seperate directories you could name the thumbnails the same as the full-size image but I would still give it a prefix such as "tn_".

    Include in your table the field image_name.
    Assuming your query is something like:

    $result=mysql_query("select * from table where whatever");
    while($data=mysql_fetch_array($result))
    {
    //whatever else you need in here to format the display
    // add this line to show the thumb as a link
    // to the fullsize image:
    print "<a href='../images/".$data[image_name]."'><img src='../thumbs/".$data[image_name]."'</a>";
    }

    Above is untested code. I might have made a small error but the logic will work.
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    I find it useful to name my images to the id of the table ie: if record> id=1 name=dog etc
    I name the image that refers to dog as 1.gif or .jpg , put the thumbnail size images in directory 'thumbs' and the larger images in the directory 'large' then when I have my query & assuming $Myrow[$x] is the id -

    <a href="bigPicPage.php3?pic=<?php echo "Myrow[$x]";?>">
    <img src="images/thumbs/<?php echo "Myrow[$x]";?>.gif width=etc">
    </a>

    then the bigPicPage would contain

    <img src="images/large/<?php echo "$pic";?>.gif">

    you can keep all the images in 1 folder and name them 1.gif , 1a.gif etc but I find keeping 2 dirs keeps things nice and tidy.

    If for some reason you have different sized images then you can use the GetImageSize() function to fill in the width/height of your thumbs - although normally thumbs of the same size look best?

    hope this helps

    Simon




    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    3
    Rep Power
    0
    Thanks a ton! I got rod k's script going.
    Got one more piece to the large puzzle I have in front of me =)
    I will move onto creating the search function, but first I am going to create pages using PHP and the database and what I just learned. Then, implenting the search function will be easier, I think.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    44
    Rep Power
    15
    Wadez, if you can get a search function to work where it will search the entire description for keywords instead of just the first word in the description, please let me know how you did it
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    44
    Rep Power
    15
    OK never mind I figured out my problems.

    Silly wildcards
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    3
    Rep Power
    0
    Ooh, how did you do that CS?

IMN logo majestic logo threadwatch logo seochat tools logo