How to compare uploaded images to see if they exist already?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jakez
    Confirmed User
    • Jan 2004
    • 5656

    #1

    How to compare uploaded images to see if they exist already?

    I'm trying to think of a way to compare uploaded images with ones that have already been uploaded. Weirdos for some reason are the most common ones that like to keep resubmitting their ugly nasty shit repeatedly. Anyone have any ideas on how this could be done? I'm thinking maybe use PHP's file_get_contents() to compare with ones already in the database but I don't really want to run thousands of comparisons 10-100 times (10,000-100,000 comparisons).

    I could store a cookie on their computer so they can't submit again but what if they're submitting new stuff?
    Last edited by Jakez; 10-24-2009, 06:48 PM.
    [email protected] - jakezdumb - 573689400

    Killuminati
  • plsureking
    bored
    • Aug 2003
    • 4910

    #2
    only thing i can think of is the file_get_contents too lol

    i think you'd only need to store the first 1000 characers of each pic tho. just put the strings in a cached txt file. then u can search the txt file when a new pic is added.
    PornCMS / low cost paysite management with hosting

    Comment

    • Libertine
      sex dwarf
      • May 2002
      • 17860

      #3
      Make the admin-delete function put the md5 hash of images in a database when you delete them, check md5 hashes of new uploads against that database?
      /(bb|[^b]{2})/

      Comment

      • Libertine
        sex dwarf
        • May 2002
        • 17860

        #4
        Oh, wait, you're not deleting the originals.

        In that case, just create a database with the md5 hashes of all new uploads, and check additional uploads against that database.
        /(bb|[^b]{2})/

        Comment

        • CYF
          Coupon Guru
          • Mar 2009
          • 10973

          #5
          can't you make a hash of each file uploaded, then compare the new photo's hash to the stuff already uploaded?

          http://www.w3schools.com/php/func_string_md5.asp
          Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more!
          AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons

          Comment

          • Libertine
            sex dwarf
            • May 2002
            • 17860

            #6
            Originally posted by CYF
            can't you make a hash of each file uploaded, then compare the new photo's hash to the stuff already uploaded?

            http://www.w3schools.com/php/func_string_md5.asp
            That's for strings, this is for files: http://php.net/manual/en/function.md5-file.php
            /(bb|[^b]{2})/

            Comment

            • Jakez
              Confirmed User
              • Jan 2004
              • 5656

              #7
              Originally posted by Libertine
              just create a database with the md5 hashes of all new uploads, and check additional uploads against that database.

              Ding ding ding ding ding ding! We have a winna! Thanks for playing.
              [email protected] - jakezdumb - 573689400

              Killuminati

              Comment

              • darksoul
                Confirmed User
                • Apr 2002
                • 4997

                #8
                they can just modify the image a bit and your md5 will not match.
                If you're looking for something more advanced see: http://www.phash.org/
                1337 5y54|)m1n: 157717888
                BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                Cambooth

                Comment

                • Jakez
                  Confirmed User
                  • Jan 2004
                  • 5656

                  #9
                  Originally posted by darksoul
                  they can just modify the image a bit and your md5 will not match.
                  If you're looking for something more advanced see: http://www.phash.org/
                  Well if they modify the image a bit then it's not the same image technically. I know what you mean, but the average surfer who is uploading nude pics from their computer probably isn't doing a whole lot of editing and resubmitting, and if they are chances are at least one of the images are going to match a previous one. That should at least filter out all the usual bs submissions I'm trying to avoid, anyone that gets past it I can deal with manually.
                  Last edited by Jakez; 10-25-2009, 02:01 AM.
                  [email protected] - jakezdumb - 573689400

                  Killuminati

                  Comment

                  • CYF
                    Coupon Guru
                    • Mar 2009
                    • 10973

                    #10
                    Originally posted by Libertine
                    That's for strings, this is for files: http://php.net/manual/en/function.md5-file.php
                    Good call. Been drinkin tonight and its 5am now rofl. Right idea, wrong link
                    Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more!
                    AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons

                    Comment

                    • HomerSimpson
                      Too lazy to set a custom title
                      • Sep 2005
                      • 13826

                      #11
                      compare md5 hashes:

                      Code:
                      $hash = md5_file($f);

                      more info about the function
                      http://php.net/manual/en/function.md5-file.php
                      Make a bank with Chaturbate - the best selling webcam program
                      Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

                      PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:

                      Comment

                      • V_RocKs
                        Damn Right I Kiss Ass!
                        • Nov 2003
                        • 32448

                        #12
                        CRC.... is your friend.

                        Comment

                        • fryer
                          Confirmed User
                          • Oct 2005
                          • 395

                          #13
                          Originally posted by Libertine
                          Make the admin-delete function put the md5 hash of images in a database when you delete them, check md5 hashes of new uploads against that database?
                          I agree with this. An md5 hash on all images uploaded then if you index the md5 field it won't take long to do the lookups.
                          fryer
                          WebCamClub/TextNDate Product Manager
                          icq: 576955851

                          Comment

                          Working...