Downsample OTG transfer thumbnails

This commit is contained in:
2026-07-08 10:31:02 +08:00
parent 773fbd1180
commit d642234b38

View File

@ -470,6 +470,7 @@ extension WiredCameraTransferViewController: UICollectionViewDelegate {
/// 线 Cell
private final class WiredTransferPhotoCell: UICollectionViewCell {
static let reuseIdentifier = "WiredTransferPhotoCell"
private static let previewImageSize = CGSize(width: 180, height: 180)
private let imageView = UIImageView()
private let statusLabel = UILabel()
@ -503,7 +504,16 @@ private final class WiredTransferPhotoCell: UICollectionViewCell {
func apply(item: TravelAlbumOTGPhotoItem, selectionMode: Bool, selected: Bool) {
if let url = item.thumbnailURL {
imageView.kf.setImage(with: url, placeholder: UIImage(systemName: "photo"))
let processor = DownsamplingImageProcessor(size: Self.previewImageSize)
imageView.kf.setImage(
with: url,
placeholder: UIImage(systemName: "photo"),
options: [
.processor(processor),
.scaleFactor(UIScreen.main.scale),
.backgroundDecode
]
)
} else {
imageView.image = UIImage(systemName: "photo")
imageView.tintColor = AppColor.textTertiary