This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal let DEFAULT_MIME_TYPE = "application/octet-stream" | |
internal let mimeTypes = [ | |
"html": "text/html", | |
"htm": "text/html", | |
"shtml": "text/html", | |
"css": "text/css", | |
"xml": "text/xml", | |
"gif": "image/gif", | |
"jpeg": "image/jpeg", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension UIImage { | |
func fixOrientation() -> UIImage { | |
let width = CGImageGetWidth(self.CGImage) | |
let height = CGImageGetHeight(self.CGImage) | |
var transform = CGAffineTransformIdentity | |
var bounds = CGRect(x:0, y:0, width:width, height:height) | |
let scaleRatio = bounds.size.width / CGFloat(width) |