Skip to content

Media picker multiplies thumbnail size by UIScreen.scale twice #21197

@kean

Description

@kean

Expected behavior

  • The requested thumbnail size matches the cell size

Actual behavior

  • The requested thumbnail sizes 4-9 times larger than required

Steps to reproduce the behavior

  • Open media picker

RCA

The media cell requests the size of the thumbnail in pixels (see WPMediaCollectionViewCell.swift:309):

CGFloat scale = [[UIScreen mainScreen] scale];
CGSize requestSize = CGSizeApplyAffineTransform(self.frame.size, CGAffineTransformMakeScale(scale, scale));

When the thumbnail is generated using WPImageURLHelper, it works OK because it accepts the size in pixels.

But when the thumbnail URL is created by PhotonImageURLHelper, it accepts size in points and multiples the size by the screen scale again. In the case of my device, 288x288px becomes 864x864px after being multiplied by the screen scale (x3).

CGFloat scale = [[UIScreen mainScreen] scale];
size.width *= scale;
size.height *= scale;

Example resulting URL: https://i0.wp.com/alextest41234.files.wordpress.com/2023/07/sample-1.gif?quality=80&resize=864,864&ssl=1

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