Browse Source

fix downscaling of avatar images in chat list, group view etc. (#226)

cyberta 5 years ago
parent
commit
e8f71c3d93
1 changed files with 5 additions and 3 deletions
  1. 5 3
      deltachat-ios/View/ContactCell.swift

+ 5 - 3
deltachat-ios/View/ContactCell.swift

@@ -165,9 +165,11 @@ class ContactCell: UITableViewCell {
     }
 
     func setImage(_ img: UIImage) {
-        let attachment = NSTextAttachment()
-        attachment.image = img
-        initialsLabel.attributedText = NSAttributedString(attachment: attachment)
+        if let resizedImg = img.resizeImage(targetSize: CGSize(width: initialsLabelSize, height: initialsLabelSize)) {
+            let attachment = NSTextAttachment()
+            attachment.image = resizedImg
+            initialsLabel.attributedText = NSAttributedString(attachment: attachment)
+        }
     }
 
     func setBackupImage(name: String, color: UIColor) {