 
             if image.size.height < image.size.width {
                 let width = (sourceImageView.image!.size.width * sourceImageView.bounds.size.width) / sourceImageView.image!.size.height
-                let x = width * 0.5 - cell.imageView.bounds.height * 0.5
+                let x = (width - cell.imageView.bounds.height) * 0.5
                 frame = CGRect(x: -1.0 * x, y: statusBarHeight, width: width, height: cell.imageView.bounds.height)
             } else {
                 frame = CGRect(x: 0.0, y: statusBarHeight, width: view.bounds.width, height: view.bounds.width)

        imageView!.kf.setImage(with: imageURLs[indexPath.row])
        return cell
    }
    
}

// MARK: - UICollectionViewDelegate

            
        } else {

            let height = (image.size.height * UIScreen.main.bounds.width) / image.size.width
            let y = (height - UIScreen.main.bounds.height - statusBarHeight) * 0.5
            frame = CGRect(x: 0.0, y: -1.0 * y, width: view.bounds.width, height: height)

        }
