                 self.sendResult()
             }, failureBlock:{
                 (myerror: NSError!) -> Void in
-                println("error occurred: \(myerror.localizedDescription)")
+                print("error occurred: \(myerror.localizedDescription)")
             }
 
         )

        var data: [String: AnyObject] = [:]
        data["id"] = id
        data["mediaType"] = setType(asset)
        var date: NSDate = asset.valueForProperty(ALAssetPropertyDate) as! NSDate
        data["dateAdded"] = date.timeIntervalSince1970
        data["path"] = asset.valueForProperty(ALAssetPropertyAssetURL).absoluteString
        var rep = asset.defaultRepresentation()
        data["size"] = Int(rep.size())
        data["orientation"] = rep.metadata()["Orientation"]
        data["title"] = rep.filename()
        data["height"] = rep.dimensions().height
        data["wigth"] = rep.dimensions().width
        data["mimeType"] = UTTypeCopyPreferredTagWithClass(rep.UTI(), kUTTagClassMIMEType).takeUnretainedValue()
        if (option["thumbnail"] as! Bool) {
            data["thumbnailPath"] = saveThumbnail(asset, id: id)
        }

        let image = UIImage(CGImage: thumbnail)
        let imageData = UIImageJPEGRepresentation(image, 0.8)
        
        let cacheDirPath: NSString = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] as? NSString
        let filePath = cacheDirPath.stringByAppendingPathComponent("\(id).jpeg")
        
        if imageData?.writeToFile(filePath, atomically: true){
            return filePath
        } else {
            print("error occured: Cannot save thumbnail image")
            return ""
        }
    }
