2

... 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);
0

Here's a partial or full fix: https://github.com/obsergiu/magento-wysiwyg-thumbail-fix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.