Skip to content

Instantly share code, notes, and snippets.

View cruisediary's full-sized avatar
🏠
Working from home

Cruz cruisediary

🏠
Working from home
View GitHub Profile
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",
@ivanovvitaly
ivanovvitaly / UIImage+RotationFix
Created July 6, 2015 20:21
UIImage category written in Swift that allows to fix the Image orientation and resize Image by long edge before uploading to the server
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)