Magento resizing images for cache and making them biggerProduct Image Cache - Image ResizingMagento images are not showing up - case sensitive filenameHow do I stop the Magento cache increasing image filesize?Cache image size is larger than the originalWhat are the different parts of an image URL, and how to generate new sizes?Magento is duplicating imagesMagento Product Images in CacheProduct's Images' URLs are not same after migrating from Magento 1.9 to Magento 2.2How to stop magento to generate all types of images in cache on page visitCache problem old images - Magento 1.9
What could be the physiological mechanism for a biological Geiger counter?
Having some issue with notation in a Hilbert space
...and then she held the gun
Does anyone recognize these rockets, and their location?
How can I detect if I'm in a subshell?
Why is Skinner so awkward in Hot Fuzz?
What do I put on my resume to make the company i'm applying to think i'm mature enough to handle a job?
How Linux command "mount -a" works
How can a flywheel makes engine runs smoothly?
How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?
How "fast" does astronomical events happen?
Co-worker is now managing my team. Does this mean that I'm being demoted?
Is the infant mortality rate among African-American babies in Youngstown, Ohio greater than that of babies in Iran?
Digital signature that is only verifiable by one specific person
How useful is the GRE Exam?
How to know whether to write accidentals as sharps or flats?
2 Managed Packages in 1 Dev Org
How do credit card companies know what type of business I'm paying for?
Using roof rails to set up hammock
Leveraging cash for buying car
Is it possible for underground bunkers on different continents to be connected?
How do I run a script as sudo at boot time on Ubuntu 18.04 Server?
Testing thermite for chemical properties
What is this plant I saw for sale at a Romanian farmer's market?
Magento resizing images for cache and making them bigger
Product Image Cache - Image ResizingMagento images are not showing up - case sensitive filenameHow do I stop the Magento cache increasing image filesize?Cache image size is larger than the originalWhat are the different parts of an image URL, and how to generate new sizes?Magento is duplicating imagesMagento Product Images in CacheProduct's Images' URLs are not same after migrating from Magento 1.9 to Magento 2.2How to stop magento to generate all types of images in cache on page visitCache problem old images - Magento 1.9
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've noticed on our Magento 1.9.3.1 store that when Magento puts product images into cache it's actually making them bigger. I'm not sure where to start debugging this or if there is a fix for it?
To give you an example I uploaded a image which was compressed to 92kb with PhotoShops Save for Web feature. However when I checked the frontend of the website I found that it had increased to 209kb.
The larger version of the file is coming from the Magento cache for product images, it's file path is:
media/catalog/product/cache/9/thumbnail/c96a280f94e22e3ee3823dd0a1a87606/i/m/img_4901-3v2.jpg

The original file still has the 92kb file size and is located in:
media/catalog/product/i/m/img_4901-3v2.jpg

Why & How could Magento be making the file bigger? Also why is it putting the cahed image in a thumbnail directory, all the cached versions of this image are being put in the thumbnail directory, i.e.
media/catalog/product/cache/9/thumbnail/200x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
media/catalog/product/cache/9/thumbnail/535x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
Where in the code does Magento process images for the cache?
I've looked in lib/tcpdf/tcpdf.php at $img->setCompressionQuality($this->jpeg_quality);. I've also checked template/catalog/product/view/media.phtml but couldn't find anything.
magento-1.9 cache product-images image
add a comment |
I've noticed on our Magento 1.9.3.1 store that when Magento puts product images into cache it's actually making them bigger. I'm not sure where to start debugging this or if there is a fix for it?
To give you an example I uploaded a image which was compressed to 92kb with PhotoShops Save for Web feature. However when I checked the frontend of the website I found that it had increased to 209kb.
The larger version of the file is coming from the Magento cache for product images, it's file path is:
media/catalog/product/cache/9/thumbnail/c96a280f94e22e3ee3823dd0a1a87606/i/m/img_4901-3v2.jpg

The original file still has the 92kb file size and is located in:
media/catalog/product/i/m/img_4901-3v2.jpg

Why & How could Magento be making the file bigger? Also why is it putting the cahed image in a thumbnail directory, all the cached versions of this image are being put in the thumbnail directory, i.e.
media/catalog/product/cache/9/thumbnail/200x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
media/catalog/product/cache/9/thumbnail/535x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
Where in the code does Magento process images for the cache?
I've looked in lib/tcpdf/tcpdf.php at $img->setCompressionQuality($this->jpeg_quality);. I've also checked template/catalog/product/view/media.phtml but couldn't find anything.
magento-1.9 cache product-images image
add a comment |
I've noticed on our Magento 1.9.3.1 store that when Magento puts product images into cache it's actually making them bigger. I'm not sure where to start debugging this or if there is a fix for it?
To give you an example I uploaded a image which was compressed to 92kb with PhotoShops Save for Web feature. However when I checked the frontend of the website I found that it had increased to 209kb.
The larger version of the file is coming from the Magento cache for product images, it's file path is:
media/catalog/product/cache/9/thumbnail/c96a280f94e22e3ee3823dd0a1a87606/i/m/img_4901-3v2.jpg

The original file still has the 92kb file size and is located in:
media/catalog/product/i/m/img_4901-3v2.jpg

Why & How could Magento be making the file bigger? Also why is it putting the cahed image in a thumbnail directory, all the cached versions of this image are being put in the thumbnail directory, i.e.
media/catalog/product/cache/9/thumbnail/200x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
media/catalog/product/cache/9/thumbnail/535x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
Where in the code does Magento process images for the cache?
I've looked in lib/tcpdf/tcpdf.php at $img->setCompressionQuality($this->jpeg_quality);. I've also checked template/catalog/product/view/media.phtml but couldn't find anything.
magento-1.9 cache product-images image
I've noticed on our Magento 1.9.3.1 store that when Magento puts product images into cache it's actually making them bigger. I'm not sure where to start debugging this or if there is a fix for it?
To give you an example I uploaded a image which was compressed to 92kb with PhotoShops Save for Web feature. However when I checked the frontend of the website I found that it had increased to 209kb.
The larger version of the file is coming from the Magento cache for product images, it's file path is:
media/catalog/product/cache/9/thumbnail/c96a280f94e22e3ee3823dd0a1a87606/i/m/img_4901-3v2.jpg

The original file still has the 92kb file size and is located in:
media/catalog/product/i/m/img_4901-3v2.jpg

Why & How could Magento be making the file bigger? Also why is it putting the cahed image in a thumbnail directory, all the cached versions of this image are being put in the thumbnail directory, i.e.
media/catalog/product/cache/9/thumbnail/200x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
media/catalog/product/cache/9/thumbnail/535x/1ac472b2e3bed24f4b7f75082897d970/i/m/img_4901-3v3.jpg
Where in the code does Magento process images for the cache?
I've looked in lib/tcpdf/tcpdf.php at $img->setCompressionQuality($this->jpeg_quality);. I've also checked template/catalog/product/view/media.phtml but couldn't find anything.
magento-1.9 cache product-images image
magento-1.9 cache product-images image
edited Mar 22 '17 at 12:57
Holly
asked Mar 22 '17 at 11:20
HollyHolly
2,37433882
2,37433882
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I found where Magento is saving the file, it actually re-saving it with a higher compression/image quality than was used in PS, thus the file is getting bigger. I can fix it but it would mean overriding a Magento core file.
This is the file responsible for increasing the image quality:
app/code/core/Mage/Catalog/Model/Product/Image.php
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_quality = 90;
/** CODE OMMITED **/
/**
* Set image quality, values in percentage from 0 to 100
*
* @param int $quality
* @return Mage_Catalog_Model_Product_Image
*/
public function setQuality($quality)
$this->_quality = $quality;
return $this;
/** CODE OMMITED **/
/** This function resizes the image**/
/**
* @return Varien_Image
*/
public function getImageProcessor()
if( !$this->_processor )
// var_dump($this->_checkMemory());
// if (!$this->_checkMemory())
// $this->_baseFile = null;
//
$this->_processor = new Varien_Image($this->getBaseFile());
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
$this->_processor->keepFrame($this->_keepFrame);
$this->_processor->keepTransparency($this->_keepTransparency);
$this->_processor->constrainOnly($this->_constrainOnly);
$this->_processor->backgroundColor($this->_backgroundColor);
$this->_processor->quality($this->_quality);
return $this->_processor;
At the beginning of the file the quality level is hardcoded to 90 and then applied in getImageProcessor(). By commenting out $this->_processor->quality($this->_quality); temporarily I can see that the issue goes away.
Why would Magento do this? This seems like it should be a common issue too. Is the best solution just to create a class override for this core Magento file?
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f165589%2fmagento-resizing-images-for-cache-and-making-them-bigger%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found where Magento is saving the file, it actually re-saving it with a higher compression/image quality than was used in PS, thus the file is getting bigger. I can fix it but it would mean overriding a Magento core file.
This is the file responsible for increasing the image quality:
app/code/core/Mage/Catalog/Model/Product/Image.php
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_quality = 90;
/** CODE OMMITED **/
/**
* Set image quality, values in percentage from 0 to 100
*
* @param int $quality
* @return Mage_Catalog_Model_Product_Image
*/
public function setQuality($quality)
$this->_quality = $quality;
return $this;
/** CODE OMMITED **/
/** This function resizes the image**/
/**
* @return Varien_Image
*/
public function getImageProcessor()
if( !$this->_processor )
// var_dump($this->_checkMemory());
// if (!$this->_checkMemory())
// $this->_baseFile = null;
//
$this->_processor = new Varien_Image($this->getBaseFile());
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
$this->_processor->keepFrame($this->_keepFrame);
$this->_processor->keepTransparency($this->_keepTransparency);
$this->_processor->constrainOnly($this->_constrainOnly);
$this->_processor->backgroundColor($this->_backgroundColor);
$this->_processor->quality($this->_quality);
return $this->_processor;
At the beginning of the file the quality level is hardcoded to 90 and then applied in getImageProcessor(). By commenting out $this->_processor->quality($this->_quality); temporarily I can see that the issue goes away.
Why would Magento do this? This seems like it should be a common issue too. Is the best solution just to create a class override for this core Magento file?
add a comment |
I found where Magento is saving the file, it actually re-saving it with a higher compression/image quality than was used in PS, thus the file is getting bigger. I can fix it but it would mean overriding a Magento core file.
This is the file responsible for increasing the image quality:
app/code/core/Mage/Catalog/Model/Product/Image.php
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_quality = 90;
/** CODE OMMITED **/
/**
* Set image quality, values in percentage from 0 to 100
*
* @param int $quality
* @return Mage_Catalog_Model_Product_Image
*/
public function setQuality($quality)
$this->_quality = $quality;
return $this;
/** CODE OMMITED **/
/** This function resizes the image**/
/**
* @return Varien_Image
*/
public function getImageProcessor()
if( !$this->_processor )
// var_dump($this->_checkMemory());
// if (!$this->_checkMemory())
// $this->_baseFile = null;
//
$this->_processor = new Varien_Image($this->getBaseFile());
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
$this->_processor->keepFrame($this->_keepFrame);
$this->_processor->keepTransparency($this->_keepTransparency);
$this->_processor->constrainOnly($this->_constrainOnly);
$this->_processor->backgroundColor($this->_backgroundColor);
$this->_processor->quality($this->_quality);
return $this->_processor;
At the beginning of the file the quality level is hardcoded to 90 and then applied in getImageProcessor(). By commenting out $this->_processor->quality($this->_quality); temporarily I can see that the issue goes away.
Why would Magento do this? This seems like it should be a common issue too. Is the best solution just to create a class override for this core Magento file?
add a comment |
I found where Magento is saving the file, it actually re-saving it with a higher compression/image quality than was used in PS, thus the file is getting bigger. I can fix it but it would mean overriding a Magento core file.
This is the file responsible for increasing the image quality:
app/code/core/Mage/Catalog/Model/Product/Image.php
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_quality = 90;
/** CODE OMMITED **/
/**
* Set image quality, values in percentage from 0 to 100
*
* @param int $quality
* @return Mage_Catalog_Model_Product_Image
*/
public function setQuality($quality)
$this->_quality = $quality;
return $this;
/** CODE OMMITED **/
/** This function resizes the image**/
/**
* @return Varien_Image
*/
public function getImageProcessor()
if( !$this->_processor )
// var_dump($this->_checkMemory());
// if (!$this->_checkMemory())
// $this->_baseFile = null;
//
$this->_processor = new Varien_Image($this->getBaseFile());
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
$this->_processor->keepFrame($this->_keepFrame);
$this->_processor->keepTransparency($this->_keepTransparency);
$this->_processor->constrainOnly($this->_constrainOnly);
$this->_processor->backgroundColor($this->_backgroundColor);
$this->_processor->quality($this->_quality);
return $this->_processor;
At the beginning of the file the quality level is hardcoded to 90 and then applied in getImageProcessor(). By commenting out $this->_processor->quality($this->_quality); temporarily I can see that the issue goes away.
Why would Magento do this? This seems like it should be a common issue too. Is the best solution just to create a class override for this core Magento file?
I found where Magento is saving the file, it actually re-saving it with a higher compression/image quality than was used in PS, thus the file is getting bigger. I can fix it but it would mean overriding a Magento core file.
This is the file responsible for increasing the image quality:
app/code/core/Mage/Catalog/Model/Product/Image.php
class Mage_Catalog_Model_Product_Image extends Mage_Core_Model_Abstract
{
protected $_width;
protected $_height;
protected $_quality = 90;
/** CODE OMMITED **/
/**
* Set image quality, values in percentage from 0 to 100
*
* @param int $quality
* @return Mage_Catalog_Model_Product_Image
*/
public function setQuality($quality)
$this->_quality = $quality;
return $this;
/** CODE OMMITED **/
/** This function resizes the image**/
/**
* @return Varien_Image
*/
public function getImageProcessor()
if( !$this->_processor )
// var_dump($this->_checkMemory());
// if (!$this->_checkMemory())
// $this->_baseFile = null;
//
$this->_processor = new Varien_Image($this->getBaseFile());
$this->_processor->keepAspectRatio($this->_keepAspectRatio);
$this->_processor->keepFrame($this->_keepFrame);
$this->_processor->keepTransparency($this->_keepTransparency);
$this->_processor->constrainOnly($this->_constrainOnly);
$this->_processor->backgroundColor($this->_backgroundColor);
$this->_processor->quality($this->_quality);
return $this->_processor;
At the beginning of the file the quality level is hardcoded to 90 and then applied in getImageProcessor(). By commenting out $this->_processor->quality($this->_quality); temporarily I can see that the issue goes away.
Why would Magento do this? This seems like it should be a common issue too. Is the best solution just to create a class override for this core Magento file?
answered Mar 22 '17 at 12:57
HollyHolly
2,37433882
2,37433882
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f165589%2fmagento-resizing-images-for-cache-and-making-them-bigger%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown