@@ -63,17 +63,24 @@ struct ImagePreviewViewModel {
63
63
}
64
64
}
65
65
66
- var info : [ ( String , String ? ) ] = [
67
- ( " Resolution " , originalImageSize. map { " \( Int ( $0 . width ) ) × \( Int ( $0 . height ) ) px " } ) ,
66
+ let info : [ ( String , String ? ) ] = [
67
+ ( " Resolution " , originalImageSize. map ( formattedResolution ) ) ,
68
68
( " Size " , ByteCountFormatter . string ( fromByteCount: context. originalSize) ) ,
69
69
( " Type " , context. contentType? . rawValue) ,
70
- ( " Displayed " , isShowingOriginal ? " original image " : " preview (original not saved )" )
70
+ ( " Source " , isShowingOriginal ? " Original " : " Thumbnail ( \( formattedResolution ( with : image . size ) ) ) " )
71
71
]
72
- if !isShowingOriginal {
73
- info. append ( ( " Preview Size (Decompressed) " , ByteCountFormatter . string ( fromByteCount: Int64 ( data. count) ) ) )
74
- }
75
72
76
73
self . image = image
77
74
self . info = KeyValueSectionViewModel ( title: " Image " , color: . pink, items: info)
78
75
}
79
76
}
77
+
78
+ private extension CGSize {
79
+ func scaled( by scale: CGFloat ) -> CGSize {
80
+ CGSize ( width: width * scale, height: width * height)
81
+ }
82
+ }
83
+
84
+ private func formattedResolution( with pixelSize: CGSize ) -> String {
85
+ " \( Int ( pixelSize. width) ) × \( Int ( pixelSize. height) ) px "
86
+ }
0 commit comments