Downsample OTG transfer thumbnails
This commit is contained in:
@ -470,6 +470,7 @@ extension WiredCameraTransferViewController: UICollectionViewDelegate {
|
|||||||
/// 有线传输照片宫格 Cell。
|
/// 有线传输照片宫格 Cell。
|
||||||
private final class WiredTransferPhotoCell: UICollectionViewCell {
|
private final class WiredTransferPhotoCell: UICollectionViewCell {
|
||||||
static let reuseIdentifier = "WiredTransferPhotoCell"
|
static let reuseIdentifier = "WiredTransferPhotoCell"
|
||||||
|
private static let previewImageSize = CGSize(width: 180, height: 180)
|
||||||
|
|
||||||
private let imageView = UIImageView()
|
private let imageView = UIImageView()
|
||||||
private let statusLabel = UILabel()
|
private let statusLabel = UILabel()
|
||||||
@ -503,7 +504,16 @@ private final class WiredTransferPhotoCell: UICollectionViewCell {
|
|||||||
|
|
||||||
func apply(item: TravelAlbumOTGPhotoItem, selectionMode: Bool, selected: Bool) {
|
func apply(item: TravelAlbumOTGPhotoItem, selectionMode: Bool, selected: Bool) {
|
||||||
if let url = item.thumbnailURL {
|
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 {
|
} else {
|
||||||
imageView.image = UIImage(systemName: "photo")
|
imageView.image = UIImage(systemName: "photo")
|
||||||
imageView.tintColor = AppColor.textTertiary
|
imageView.tintColor = AppColor.textTertiary
|
||||||
|
|||||||
Reference in New Issue
Block a user