GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How to compare uploaded images to see if they exist already? (https://gfy.com/showthread.php?t=935161)

Jakez 10-24-2009 07:45 PM

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?

plsureking 10-24-2009 08:02 PM

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.

Libertine 10-24-2009 08:06 PM

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?

Libertine 10-24-2009 08:12 PM

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.

CYF 10-24-2009 08:14 PM

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

Libertine 10-24-2009 08:17 PM

Quote:

Originally Posted by CYF (Post 16463196)
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

Jakez 10-24-2009 09:48 PM

Quote:

Originally Posted by Libertine (Post 16463193)
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.

darksoul 10-25-2009 01:21 AM

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/

Jakez 10-25-2009 02:59 AM

Quote:

Originally Posted by darksoul (Post 16463505)
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.

CYF 10-25-2009 03:06 AM

Quote:

Originally Posted by Libertine (Post 16463198)
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 :thumbsup

HomerSimpson 10-25-2009 08:01 AM

compare md5 hashes:

Code:

$hash = md5_file($f);

more info about the function
http://php.net/manual/en/function.md5-file.php

V_RocKs 10-25-2009 08:58 AM

CRC.... is your friend.

fryer 10-25-2009 09:53 AM

Quote:

Originally Posted by Libertine (Post 16463183)
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.


All times are GMT -7. The time now is 03:06 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc