You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
the one you mentioned: same base filename + same phpthumb options + same resource + different paths = same output filename.
there's another problem too: same path + same base filename + same phpthumb options + different resource = different output filenames.
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:
same base filename + same phpthumb options + same resource + different paths = different output filenames
same path + same base filename + same phpthumb options + different resource = same output filename
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.
Activity
mburtscher commentedon Jan 28, 2013
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
oo12 commentedon Feb 26, 2013
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.