... or "breaking already broken features - what is Mage_Core_Model_File_Uploader::getCorrectFileName() for?"
M1 has a bug that thumbnails used in CMS blocks/pages (insert image button) are not stored/loeaded correctly.
To fix this we have used solution from https://www.ctidigital.com/blog/fixing-magento-improving-performance-of-the-wysiwyg-editor/
Worked well for years but now I've seen 1.9.4 also broke this!
1.9.4 replaced
Mage_Cms_Model_Wysiwyg_Images_Storage::getFilesCollection()
$thumbUrl = $this->getThumbnailUrl($item->getFilename(), true);
with
$thumbUrl = $this->getThumbnailUrl(
Mage_Core_Model_File_Uploader::getCorrectFileName($item->getFilename()),
true);
This passes the complete image path to getCorrectFileName()
(instead of filename only) and replaces all backslashes with underscores leading to always failed checks in getThumbnailUrl()
- so every thumb is generated new every time.
/**
* Correct filename with special chars and spaces
*
* @param string $fileName
* @return string
*/
static public function getCorrectFileName($fileName)
This turns var/www/[...]/Some/Image.jpg
into _var_www_[...]_Some_Image.jpg
...
Do you have a better idea then this?
$thumbImg = Mage_Core_Model_File_Uploader::getCorrectFileName($item->getBasename());
...
$thumbUrl = $this->getThumbnailUrl($path . DS . $thumbImg, true);