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;








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


enter image description here



The original file still has the 92kb file size and is located in:



media/catalog/product/i/m/img_4901-3v2.jpg


enter image description here



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.










share|improve this question






























    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


    enter image description here



    The original file still has the 92kb file size and is located in:



    media/catalog/product/i/m/img_4901-3v2.jpg


    enter image description here



    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.










    share|improve this question


























      0












      0








      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


      enter image description here



      The original file still has the 92kb file size and is located in:



      media/catalog/product/i/m/img_4901-3v2.jpg


      enter image description here



      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.










      share|improve this question
















      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


      enter image description here



      The original file still has the 92kb file size and is located in:



      media/catalog/product/i/m/img_4901-3v2.jpg


      enter image description here



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 '17 at 12:57







      Holly

















      asked Mar 22 '17 at 11:20









      HollyHolly

      2,37433882




      2,37433882




















          1 Answer
          1






          active

          oldest

          votes


















          0














          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?






          share|improve this answer























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



            );













            draft saved

            draft discarded


















            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









            0














            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?






            share|improve this answer



























              0














              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?






              share|improve this answer

























                0












                0








                0







                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?






                share|improve this answer













                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?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 '17 at 12:57









                HollyHolly

                2,37433882




                2,37433882



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                    Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                    Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림