             }
             
             self.imageView2.image = imageResult
-            
-            //self.imageView.image = image! as UIImage
-            print("detail image was loaded")
         })
         
-        
+
     }
 
     

    }
    
    
    func loadPreviousPreviewImage(){
        // load the asset image for the detail view
        
        
        var previewPosition: Int = indexPosition - 1
        
        if(phAssetResult.count > 0){
            
            // did we reach the end of the list, then switch to the start
            if(previewPosition < 0){
                previewPosition = phAssetResult.count - 1
            }
            
        }
        
 
        
        
        let asset: PHAsset = getAsset(atIndex: previewPosition)
        
        
        //let imageManager = PHCachingImageManager()
        let imageManager = PHImageManager()

        var imageSize: CGSize
        
        let imageFrame = imageView.frame

        options.isNetworkAccessAllowed = true
        
        
        //options.deliveryMode = .opportunistic
        options.deliveryMode = .highQualityFormat
        
