         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier, for: indexPath)
         if let cell = cell as? CKPhotoBaseCollectionViewCell {
             let resource = ImageResource(downloadURL: imageUrls[indexPath.row])
-            cell.ivImage.kf.setImage(with: resource, placeholder: nil, options: nil, progressBlock: nil, completionHandler: nil)
+            cell.ivImage.kf.setImage(with: resource, placeholder: nil, options: nil, progressBlock: nil, completionHandler: { (image, error, type, url) in
+                if let image = image {
+                    if self.isVertical {
+                        if image.size.width > image.size.height {
+                            let rotatedImage = UIImage(cgImage: image.cgImage!, scale: CGFloat(1.0), orientation: .right)
+                            cell.ivImage.image = rotatedImage
+                        }
+                    }
+                }
+            })
+            
         }
         return cell
     }

                }
                
                if loadedCount == count {
                    self.collectionView?.reloadData()
                }
                else {

    //MARK: -  UICollectionViewDelegateFlowLayout
    
    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return self.finalSize
    }
    
    
