0
A
回答
0
這似乎與Magento的1.9.3.3或應用補丁SUPEE 9767
後經常發生。 請閱讀此Watermark get black background when transparent
0
有同樣的問題,在修補程序之前上傳舊lib/Varien/Image/Adapter/Gd2.php並重新工作。
0
我對我的Magento 1.9.3.3版本有同樣的問題。下面修復解決我的問題
擴展此類文件Mage_Core_Model_File_Validator_Image
。
創建模塊:
在Magegeeks_Core_Model_File_Validator_Image
克里特文件與以下內容:
class Magegeeks_Core_Model_File_Validator_Image extends Mage_Core_Model_File_Validator_Image
{
/**
* Validation callback for checking is file is image
*
* @param string $filePath Path to temporary uploaded file
* @return null
* @throws Mage_Core_Exception
*/
public function validate($filePath)
{
list($imageWidth, $imageHeight, $fileType) = getimagesize($filePath);
if ($fileType) {
if ($this->isImageType($fileType)) {
//replace tmp image with re-sampled copy to exclude images with malicious data
$image = imagecreatefromstring(file_get_contents($filePath));
if ($image !== false) {
$img = imagecreatetruecolor($imageWidth, $imageHeight);
imagealphablending($img, false);
imagecopyresampled($img, $image, 0, 0, 0, 0, $imageWidth, $imageHeight, $imageWidth, $imageHeight);
imagesavealpha($img, true);
switch ($fileType) {
case IMAGETYPE_GIF:
imagegif($img, $filePath);
break;
case IMAGETYPE_JPEG:
imagejpeg($img, $filePath, 100);
break;
case IMAGETYPE_PNG:
imagepng($img, $filePath);
break;
default:
return;
}
imagedestroy($img);
imagedestroy($image);
return null;
} else {
throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid image.'));
}
}
}
throw Mage::exception('Mage_Core', Mage::helper('core')->__('Invalid MIME type.'));
}
在等/ config.xml文件:
<config>
<modules>
<Magegeeks_Core>
<version>0.0.1</version>
</Magegeeks_Core>
</modules>
<global>
<models>
<sdm_core>
<class>Magegeeks_Core_Model</class>
</sdm_core>
<core>
<rewrite>
<file_validator_image>SDM_Core_Model_File_Validator_Image</file_validator_image>
</rewrite>
</core>
</models>
</global>
</config>
應用的/ etc/modules/Magegeeks_Core.xml
<config>
<modules>
<Magegeeks_Core>
<active>true</active>
<codePool>local</codePool>
</Magegeeks_Core>
</modules>
</config>
希望這能解決您的問題。
相關問題
- 1. imagecopyresampled PNG黑色背景
- 2. PNG有黑色背景
- 3. Magento如何刪除圖像背景中的黑色圖像
- 4. PNG圖像顯示上傳/調整大小的黑色背景
- 5. PHP&JS - Jcrop - 選擇的PNG圖像具有黑色背景
- 6. 下載了帶有黑色背景的透明背景png圖像
- 7. PNG透明背景=與黑色背景縮略圖
- 8. 仍然呈現PNG圖像背景黑色
- 9. Png黑色背景上傳和調整圖像大小
- 10. 給圖像一個黑色的背景?
- 11. CSS背景顏色和PNG圖像
- 12. PHP png黑色背景已上傳
- 13. 從PNG圖像創建jpg圖像時將html canvas黑色背景更改爲白色背景
- 14. Firefox顯示背景圖像黑色
- 15. php imagick圖像圓角黑色背景
- 16. PNG圖像呈現黑色
- 17. 加載RGB PNG導致黑色圖像
- 18. ie6爲透明背景顯示圖像(.PNG)背景色
- 19. StatusBar背景黑色,UIAlertView背景黑色,一切都是黑色
- 20. 從png位圖的黑色背景的AS3 Flex面具
- 21. ffmpeg - 將白色背景的png轉換爲黑色背景的電影
- 22. 讓在黑色背景的圖像發光的圖像
- 23. 從URI加載的圖像有黑色背景
- 24. 用python添加沒有黑色背景的粘貼圖像
- 25. PHP中的圖像疊加;黑色背景?
- 26. 使用Graphics.DrawImage,將透明PNG圖像的背景更改爲黑色
- 27. iOS:背景圖像黑色而不是請求的圖像?
- 28. imagecopy黑色背景
- 29. 背景是黑色
- 30. 在平移圖像背後的黑色背景。 Swift 3