In case you use one of the Amasty extensions, e.g. Amasty Layered navigation, you may face the issue of the broken blog featured images after the upload.
We have found the issue in Amasty_Shopby extensions, that breaks some other extensions using image upload functionality, including our Magento 2 Blog Extension.
Amasty_Shopby in this file:
app/code/Amasty/Shopby/etc/adminhtml/di.xml
adds the plugin to Magento\Catalog\Model\ImageUploader model.
Judging from the code in the following file:
app/code/Amasty/Shopby/Plugin/Catalog/Model/ImageUploaderPlugin.php
it looks like some fix Amasty added for Magento 2.3.4. and the issue lies in the plugin beforeMoveFileFromTmp.
The original Magento MoveFileFromTmp declaration looks like this:
public function moveFileFromTmp($imageName, $returnRelativePath = false)
and Amasty's plugin missing the second parameter $returnRelativePath:
public function beforeMoveFileFromTmp(\Magento\Catalog\Model\ImageUploader $subject, $path)
So, basically, Amasty's plugin kills the second function parameter.
To fix this issue you can replace this code in ImageUploaderPlugin.php
public function beforeMoveFileFromTmp(\Magento\Catalog\Model\ImageUploader $subject, $path)
{
$posLastSlash = strripos($path, '/');
return $posLastSlash && strpos($path, '/category/') !== false
? substr($path, $posLastSlash + 1)
: $path;
}
with this one
public function beforeMoveFileFromTmp(\Magento\Catalog\Model\ImageUploader $subject, $path, $returnRelativePath = false)
{
$posLastSlash = strripos($path, '/');
return $posLastSlash && strpos($path, '/category/') !== false
? [substr($path, $posLastSlash + 1), $returnRelativePath]
: [$path, $returnRelativePath];
}
We have also contacted Amasty support regarding this issue and they're working on a permanent fix.
UPD (2020-10-02): Today we have received a reply from Amasty:
I just received a note from our devs and they kindly noted that the reported issue has been just recently fixed in the module's 2.14.7 version, so feel free to update it and see how it works for you then.