Skip to content

Commit c493d43

Browse files
authored
Allow rewrite Varien_Image (#2666)
1 parent 37227a3 commit c493d43

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

app/code/core/Mage/Catalog/Helper/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ public function validateUploadFile($filePath)
645645
Mage::throwException($this->__('Disallowed file format.'));
646646
}
647647

648-
$_processor = new Varien_Image($filePath);
648+
$_processor = Mage::getModel('varien/image', $filePath);
649649
$mimeType = $_processor->getMimeType();
650650

651651
// Force garbage collection since image handler resource uses memory without counting toward memory limit

app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function _create(array $data)
6969
// try to create Image object to check if image data is valid
7070
try {
7171
$filePath = $apiTempDir . DS . $imageFileName;
72-
new Varien_Image($filePath);
72+
Mage::getModel('varien/image', $filePath);
7373
Mage::getModel('core/file_validator_image')->validate($filePath);
7474
} catch (Exception $e) {
7575
$ioAdapter->rmdir($apiTempDir, true);

app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function create($productId, $data, $store = null, $identifierType = null)
158158
// try to create Image object - it fails with Exception if image is not supported
159159
try {
160160
$filePath = $tmpDirectory . DS . $fileName;
161-
new Varien_Image($filePath);
161+
Mage::getModel('varien/image', $filePath);
162162
Mage::getModel('core/file_validator_image')->validate($filePath);
163163
} catch (Exception $e) {
164164
// Remove temporary directory

app/code/core/Mage/Catalog/Model/Product/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public function setImageProcessor($processor)
451451
public function getImageProcessor()
452452
{
453453
if (!$this->_processor) {
454-
$this->_processor = new Varien_Image($this->getBaseFile());
454+
$this->_processor = Mage::getModel('varien/image', $this->getBaseFile());
455455
}
456456
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
457457
$this->_processor->keepFrame($this->_keepFrame);

app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ protected function _resizeSwatchImage($filename, $tag, $width, $height)
308308
}
309309

310310
// Do resize and save
311-
$processor = new Varien_Image($sourceFilePath);
311+
$processor = Mage::getModel('varien/image', $sourceFilePath);
312312
$processor->resize($width, $height);
313313
$processor->save(Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . $destPath);
314314
Mage::helper('core/file_storage_database')->saveFile($destPath);

0 commit comments

Comments
 (0)