-
Notifications
You must be signed in to change notification settings - Fork 17
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
[Bug] phpThumbOf + getResources/MIGX #48
Comments
This seems to be a new bug! We hadn't had this issue before. Using modx 2.2.6-pl and phpthumbof 1.4.0 |
Quick fix: set phpthumbof.hash_thumbnail_names to Yes in System Settings. If you have this turned off (the default) so your filenames are in this format file_name.options_hash.file_extension (for example: slide1.17257f7f69358c7cfb0c8d1dd1b859a014.jpg ) then the way phpthumbof generates filenames creates two potential problems.
I have a site with a few hundred pages, and many of those pages use the same 4 images for one part (sized by phpthumbof). I happened to look in phpthumbof's cache and was surprised to find thousands of versions of the same 4 files! I tracked it down to line 306 in core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php:
$this->cacheFilename is the base name of the file (so 'slide1' in the example above). You can see what's going wrong. Seems a better way to do it would be this:
I think that will fix both your problem and mine. That changes the "equations" above to:
Or am I missing something? If hash collisions are a problem with the extra data in there, switching to sha1–only marginally slower than md5–would probably solve it. |
If you use the same filename in different paths phpThumbOf will output the same file.
Resource 1:
Filepath original: img/resrouce-1/file.jpg
Filepath phpThumbOf: /assets/components/phpthumbof/cache/file.hash.jpg
Resource 2:
Filepath original: img/resrouce-2/file.jpg
Filepath phpThumbOf: /assets/components/phpthumbof/cache/file.hash.jpg
phpThumbOf uses the same file for both resources, because the path is not considered.
The text was updated successfully, but these errors were encountered: