         let imageViewDoubleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(gestureRecognizer:)))
         imageViewDoubleTapRecognizer.numberOfTapsRequired = 2
         imageViewSingleTapRecognizer.require(toFail: imageViewDoubleTapRecognizer)
+        photoImageView.contentMode = .scaleAspectFit
         photoImageView.isUserInteractionEnabled = true
         photoImageView.addGestureRecognizer(imageViewSingleTapRecognizer)
         photoImageView.addGestureRecognizer(imageViewDoubleTapRecognizer)

        minimumZoomScale = minScale;
        zoomScale = minScale;
        
        photoImageView.frame = CGRect(x: 0, y: 0, width: photoImageView.frame.size.width, height: photoImageView.frame.size.height).insetBy(dx: padding, dy: padding)
        
        setNeedsLayout()
    }

            photoImageView.image = image
            photoImageView.isHidden = false
            
            photoImageView.frame = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
            contentSize = photoImageView.frame.size
            
            setMaxMinZoomScalesForCurrentBounds()
            activityIndicatorView.stopAnimating()
