Skip to content

*.jpg is not generated for scaled full size image. #122

Closed

Description

@mitogh

Steps to replicate

2022-01-20_19-02

Image meta data stored in WordPress

Metadata of the image.
=> array(6) {
  ["width"]=>
  int(1707)
  ["height"]=>
  int(2560)
  ["file"]=>
  string(55) "2022/01/philip-myrtorp-hDBdvjk1b0s-unsplash-scaled.webp"
  ["sizes"]=>
  array(7) {
    ["medium"]=>
    array(4) {
      ["file"]=>
      string(48) "philip-myrtorp-hDBdvjk1b0s-unsplash-200x300.webp"
      ["width"]=>
      int(200)
      ["height"]=>
      int(300)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["large"]=>
    array(4) {
      ["file"]=>
      string(49) "philip-myrtorp-hDBdvjk1b0s-unsplash-683x1024.webp"
      ["width"]=>
      int(683)
      ["height"]=>
      int(1024)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["thumbnail"]=>
    array(4) {
      ["file"]=>
      string(48) "philip-myrtorp-hDBdvjk1b0s-unsplash-150x150.webp"
      ["width"]=>
      int(150)
      ["height"]=>
      int(150)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["medium_large"]=>
    array(4) {
      ["file"]=>
      string(49) "philip-myrtorp-hDBdvjk1b0s-unsplash-768x1152.webp"
      ["width"]=>
      int(768)
      ["height"]=>
      int(1152)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["1536x1536"]=>
    array(4) {
      ["file"]=>
      string(50) "philip-myrtorp-hDBdvjk1b0s-unsplash-1024x1536.webp"
      ["width"]=>
      int(1024)
      ["height"]=>
      int(1536)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["2048x2048"]=>
    array(4) {
      ["file"]=>
      string(50) "philip-myrtorp-hDBdvjk1b0s-unsplash-1365x2048.webp"
      ["width"]=>
      int(1365)
      ["height"]=>
      int(2048)
      ["mime-type"]=>
      string(10) "image/webp"
    }
    ["post-thumbnail"]=>
    array(4) {
      ["file"]=>
      string(50) "philip-myrtorp-hDBdvjk1b0s-unsplash-1568x2352.webp"
      ["width"]=>
      int(1568)
      ["height"]=>
      int(2352)
      ["mime-type"]=>
      string(10) "image/webp"
    }
  }
  ["image_meta"]=>
  array(12) {
    ["aperture"]=>
    string(1) "0"
    ["credit"]=>
    string(0) ""
    ["camera"]=>
    string(0) ""
    ["caption"]=>
    string(0) ""
    ["created_timestamp"]=>
    string(1) "0"
    ["copyright"]=>
    string(0) ""
    ["focal_length"]=>
    string(1) "0"
    ["iso"]=>
    string(1) "0"
    ["shutter_speed"]=>
    string(1) "0"
    ["title"]=>
    string(0) ""
    ["orientation"]=>
    string(1) "0"
    ["keywords"]=>
    array(0) {
    }
  }
  ["original_image"]=>
  string(39) "philip-myrtorp-hDBdvjk1b0s-unsplash.jpg"
}

This happens due to the new "full size" being scaled down to match the threshold from WordPress and prevents having a fallback *.jpg for the scaled size (full size).

Image used for testing this behavior.

philip-myrtorp-hDBdvjk1b0s-unsplash

Activity

  1. changed the title [-]*.jpeg is not generated for full size image.[/-] [+]`*.jpeg` is not generated for full size image.[/+] on Jan 21, 2022
  2. changed the title [-]`*.jpeg` is not generated for full size image.[/-] [+]`*.jpg` is not generated for full size image.[/+] on Jan 21, 2022
  3. changed the title [-]`*.jpg` is not generated for full size image.[/-] [+]`*.jpg` is not generated for scaled full size image.[/+] on Jan 21, 2022
  4. getsource commented on Jan 21, 2022

    @getsource
    Member

    Thanks so much for the report!

    The original full size uploaded image (in JPEG) should still be there (as is listed in the meta under "original image").
    Just to confirm, is that the case? This image could act as a fallback if images need to be re-generated at some point.

    My understanding is that the intent is for WebP to be the primary format when that module is enabled, so this sounds to me like the intended behavior.

    It sounds like the behavior is inconsistent, though, between uploading an image larger/smaller than the big_image_size_threshold. Since if it's smaller, the types would be mixed (although as you note, it has the benefit of acting as a larger sized fallback).

    @adamsilverstein What do you think?

  5. mitogh commented on Jan 21, 2022

    @mitogh
    MemberAuthor

    The original full size uploaded image (in JPEG) should still be there (as is listed in the meta under "original image").
    Just to confirm, is that the case? This image could act as a fallback if images need to be re-generated at some point.

    That's correct, full-size image is still uploaded as specified on the meta but is the full-size image tho not the scaled version with the maximum dimensions set by WordPress.

    Additionally, I think using the original image as a fallback does not provide a performance benefit, on the contrary, it loads a nonoptimized image in terms of size and quality to a device where modern images are not supported and instead a more appropriate size should be loaded as a fallback instead.

  6. adamsilverstein commented on Feb 10, 2022

    @adamsilverstein
    Member

    Fixed in #143

  7. mitogh commented on Feb 12, 2022

    @mitogh
    MemberAuthor

    Related with the following core ticket:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions