Results 1 to 3 of 3

Thread: Only show "new" images...?

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Only show "new" images...?

    here is the basics.

    I have a gallery that is run from a database. the DB table only has some basics and a file name. I will be building a edit page so that you can easily add new images to the gallery. I will upload the image through FTP.

    I would like the edit page to grab the file list from the table, and scan the files on the server. any img that is NOT in the database will be the ones that show.

    Now I know I could just loop through the directory and check each filename in the database... but whats the best way? Should I create an array of the files, then just loop through that? two arrays?

    Thanks!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Only show "new" images...?

    What you should do is have a "uploaded" folder where you upload all the new pictures. Then run the edit page. The edit page should look in the "uploaded" folder, write to the db, then copy that image to another folder "images", then move to the next image. So afterward, the "uploaded" folder will be empty, and you can upload more later.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Only show "new" images...?

    Select the list of file names from the database, put them into an array, then use array_diff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width