Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRC32 collision issue #66

Open
BenceSzalai opened this issue Aug 28, 2020 · 0 comments
Open

CRC32 collision issue #66

BenceSzalai opened this issue Aug 28, 2020 · 0 comments

Comments

@BenceSzalai
Copy link

BenceSzalai commented Aug 28, 2020

The phpThumbOf::createThumbnail() method uses the name of the resizer, the time the image was uploaded, the original filename, phpThumb options and the remote url, if any to generate the CRC part of the cached image filename.

I've just ran into a situation, when all these matched, and one image started to overwrite another. Lost some hair until I've figured out what was going on.

Suggestion:
Add file size to $modflags after phpthumbof.class.php#L321. Something like this:

$modflags .= filesize($this->input);

Or even better, to completely eliminate the issue, even when file sizes match: use the full path of the original image instead of the filename only. This can be done easily by using this instead of line 307 of phpthumbof.class.php

$hashExtras = $this->input;

Let me know if you'd like a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant