|
@@ -616,9 +616,17 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
|
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
if let dirPath = paths.first {
|
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(image)
|
|
|
- let image = UIImage(contentsOfFile: imageURL.path)
|
|
|
- let imageWidth = image!.size.width
|
|
|
- let imageHeight = image!.size.height
|
|
|
+ var imagePath = UIImage(contentsOfFile: imageURL.path)
|
|
|
+ if imagePath == nil {
|
|
|
+ Download().startHTTP(forKey: image) { (name, progress) in
|
|
|
+ guard progress == 100 else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ imagePath = UIImage(named: "Send-Image", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
|
|
|
+ }
|
|
|
+ let imageWidth = imagePath!.size.width
|
|
|
+ let imageHeight = imagePath!.size.height
|
|
|
|
|
|
// Calculate the aspect ratio of the image
|
|
|
let aspectRatio = imageWidth / imageHeight
|