Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46763

Save user images as JPEG if uploaded in that format.

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing instructions:

      Testing instructions (Firefox required)

      1. Edit current user profile
      2. Upload jpeg image to user picture
      3. Save profile
      4. Confirm that user picture (avatar) has changed
      5. Hover over image and right hand click and select 'View Image Info'

      Expected: 'Type' should read 'JPEG Image'

      6. Edit current user profile
      7. Upload png image to user picture
      8. Save profile
      9. Confirm that user picture (avatar) has changed
      10. Hover over image and right hand click and select 'View Image Info'

      Expected: 'Type' should read 'PNG Image'

      Show
      Testing instructions: Testing instructions (Firefox required) 1. Edit current user profile 2. Upload jpeg image to user picture 3. Save profile 4. Confirm that user picture (avatar) has changed 5. Hover over image and right hand click and select 'View Image Info' Expected: 'Type' should read 'JPEG Image' 6. Edit current user profile 7. Upload png image to user picture 8. Save profile 9. Confirm that user picture (avatar) has changed 10. Hover over image and right hand click and select 'View Image Info' Expected: 'Type' should read 'PNG Image'
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46763_keep_jpg_avatars_as_jpg

      Description

      Moodle supports user icons in both PNG and JPEG format, depending on how the server is set up.

      Currently if both are available everything is saved as PNG.

      The size of most user images could probably be drastically reduced if JPEG was the default instead since it's much better than PNG for "photographic" style images.

      A quick test suggests the user images could be 2 or 3 times smaller than they are now.

      Some images aren't well suited to JPEG compression though and require the lossless compression of PNG. A good rule of thumb would be to save images uploaded as PNG (or GIF) as PNG, and those uploaded as JPEG as JPEG.

      When looking at this code I noticed the default quality for JPEG is set to 90, which, assuming the number means what I think it means, is quite high. Possibly tweaking that downwards would be a good idea too.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/May/15