0

I have a folder with about 2000 images size 37x13, when i add a new image i want to look for a pixel perfect match before i add it to the folder.

What i need is a match function, returning true of false, so i can react if there's a match. I imagine it can be done with imagick, but do not have that installed, and would like to be able to do this without installing imagick.

So what i ask is, is there a way to see if an image matches another perfectly with PHP/GD?

2 Answers 2

1

I haven't tried this myself, but I would assume that using hash_file would work for what you're trying to do.

Hash both files using hash_file and compare them. If they match, then the images should be the same.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked, seems obvious when i look at it now... Thanks. :)
1

How about doing a hash on the file?

https://www.php.net/manual/en/function.sha1-file.php

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.