Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-383

Scale image quality setting is incorrect for PNG images

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.0.3-B1
    • Component/s: Data Management
    • Labels:
      None
    • Additional information:
      Hide

      We use 100 as image quality for resized images. This is not always true, see
      image function description above:

      • imagejpeg - 100;
      • imagegif - doesn't have quality parameter at all;
      • imagepng - 9.

      That's why all resized PNG images are broken in result (just black). Maybe
      value of 100 at least worked some how before PHP 5.2 or maybe we were not
      using PNG images a lot in our projects.

      Show
      We use 100 as image quality for resized images. This is not always true, see image function description above: imagejpeg - 100; imagegif - doesn't have quality parameter at all; imagepng - 9. That's why all resized PNG images are broken in result (just black). Maybe value of 100 at least worked some how before PHP 5.2 or maybe we were not using PNG images a lot in our projects.
    • External issue ID:
      458
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      In ImageHelper we have method called ScaleImage. In the end of process
      it does, it saves image with functions such as imagejpeg, imagepng,
      imagegif, etc. These functions take quality parameter, and we pass
      hardcoded quality value = 100. But imagepng function may have only 0-9
      value range, and if quality is not in this range, it saves broken
      image file. So resize/watermarking never worked for png images.

      Note: png quality parameter values are reversed related to jpeg: 0
      means no compression, and 9 means highest possible compression.

      I think we need to investigate about other image saving functions,
      what quality values they take.

      Also, as improvement, we may add configuration value for resized image
      quality, so site administrator will be able to control size-quality
      balance.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: