SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do they do this?

    www.fakerssuck.com

    they have a quick checker where you upload a picture and it checks if it has the same one already on it's system

    how is this done with PHP?

    and

    www.buddypic.com

    they track images (I'm asuming it's the same way)
    on the pending panel it says how many of the same images have been uploaded on the site

    if osmeone can help me find out how this is done I will love you for ever.. well.. atleast for 10 minutes :P

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Comparing every file in their database to the uploaded one would be awfully intensive -- either a slow query if the images are stored as binary data in the database, or a ton of I/O to open every file and compare its contents to the uploaded file.

    I would store a checksum for each image and compare that to the checksum of the uploaded file. If the signatures match, a byte-comparison could be performed to be sure the two images are the same.

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    agreed.
    i would probably pass the binary image data to md5(), or just use md5_file() and store the result in a database. then you can just see if the md5 of the uploaded file matches one in your db.

  4. #4
    Non-Member I87's Avatar
    Join Date
    Mar 2006
    Location
    UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought about doing it like that
    buddypic has checksums for all of the pictures..
    but how would it be done? an md5 of the file name and/or the file size?
    would that be acurate?
    I'm sure there's millions of pictures ith the same name and size

  5. #5
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its not actually md5'ing the file name, but the file. It is possible to get md5 collisions, but it is unlikely.

    So if you upload the file, perfom a md5_file(filename) and then store that value in the database you should be able to check for an existing file by searching the md5_hashes.

  6. #6
    Evil Genius MilchstrabeStern's Avatar
    Join Date
    Nov 2003
    Location
    Arizona
    Posts
    1,131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course this system isn't completely full proof either.

    I mean, if one pixel is slightly different they won't match, even though they really are the same picture. It'd be cool if it were able to recognize such differences.
    ]


Bookmarks

Posting Permissions

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