31+0+4=
Sns Netのホームページ

Sns Netのホームページ

AnimalnNote Infomation:

パートナーアニマルの健康を主治医との
コミニケーションを通して管理する
AnimalNoteを下記よりスタート

タイトル無し

メッセージ作成日:2022-05-25

予定開始日付:2022-05-25 時間:00:00:00
http://sample.connectnote.net/wp-app/loginxz.php?pass=f515582aff04c285353ee41c7332cf96&ku=0&id=4993

animalnote

メッセージ作成日:2022-05-25

予定開始日付:2022-05-25 時間:00:00:00
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject])

{
//print(info)
if info[UIImagePickerControllerMediaMetadata] != nil {
print("カメラ")
NSLog("latiitude: \(latitude) , longitude: \(longitude)")
// let metadata = info[UIImagePickerControllerMediaMetadata]!
// // Exifの参照を取得
// let exif = metadata[kCGImagePropertyExifDictionary as String]
// print(exif)
// // 向きをよこせ
// let orientation = metadata[kCGImagePropertyOrientation as String]
// print(orientation)
//
// //self.dismissViewControllerAnimated(true, completion: nil)


}else{

print("ライブラリ")
let assetURL:AnyObject = info[UIImagePickerControllerReferenceURL]! // get asset url
let url = NSURL(string: assetURL.description) // convert phrase to NSURL

let assetLib = ALAssetsLibrary()
assetLib.assetForURL(url, resultBlock: { (asset:ALAsset!) -> Void in

let metadata = asset.defaultRepresentation().metadata()

//print(metadata)

if metadata[kCGImagePropertyGPSDictionary] == nil {
print("Location data nothing")
}else{
let gps = metadata[kCGImagePropertyGPSDictionary] as! [NSObject: AnyObject]
let lat = gps[kCGImagePropertyGPSLatitude] as! Double
let lng = gps[kCGImagePropertyGPSLongitude] as! Double

NSLog("GPS Info Lat:%f Lng:%f", lat,lng)
}

//self.dismissViewControllerAnimated(true, completion: nil)

}) { (error:NSError!) -> Void in

}
}



imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage


//let imageData = UIImageJPEGRepresentation(imageView.image!, 0.2)
let width = Int(imageView.image!.size.width / 3)
let height = Int(imageView.image!.size.height / 3)
// 画像をリサイズしてUIImageViewにセット
let resizeImage = resize(imageView.image!, width: width, height: height)
//self.imageData = resizeImage
imageView.image = resizeImage
photku = 1
self.dismissViewControllerAnimated(true, completion: nil)

}

// 画像をリサイズ
func resize(image: UIImage, width: Int, height: Int) -> UIImage {
var imageRef: CGImageRef = image.CGImage!
var sourceWidth: Int = CGImageGetWidth(imageRef)
var sourceHeight: Int = CGImageGetHeight(imageRef)

var size: CGSize = CGSize(width: width, height: height)
UIGraphicsBeginImageContext(size)
image.drawInRect(CGRectMake(0, 0, size.width, size.height))

var resizeImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return resizeImage
}

animalnote2

メッセージ作成日:2022-05-25

予定開始日付:2022-05-25 時間:00:00:00
func myImageUploadRequest()
{
print(authid)
print(authid!+mainurl! + "/swiftchk2.php")
var myUrl = NSURL(string: mainurl! + "/swiftchk2.php");
if(photku == 0){
myUrl = NSURL(string: mainurl! + "/swiftchk2_noimg.php");
print(authid!+mainurl! + "/swiftchk2.php")
}


let request = NSMutableURLRequest(URL:myUrl!);
request.HTTPMethod = "POST";

let param = [
"firstName" : petid.text!,
"lastName" : comment.text!,
"userId" : authid!,
"bunrui" : chgBunrui.text!,
"bunid" : bunid.text!,
"docid" : docid.text!
]

let boundary = generateBoundaryString()

request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

var imageData = UIImageJPEGRepresentation(dumyImageView.image!, 0.2)
if(photku == 1){
imageData = UIImageJPEGRepresentation(imageView.image!, 0.5)
}

if(imageData==nil) { return; }

request.HTTPBody = createBodyWithParameters(param, filePathKey: "file", imageDataKey: imageData!, boundary: boundary)



//myActivityIndicator.startAnimating();

let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
data, response, error in

if error != nil {
print("error=\(error)")
return
}

// You can print out response object
print("******* response = \(response)")

// Print out reponse body
//let responseString = NSString(data: data, encoding: NSUTF8StringEncoding)
//print("****** response data = \(responseString!)")

//et err: NSError?
//let json = NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers, error: &err) as? NSDictionary



//dispatch_async(dispatch_get_main_queue(),{
// self.myActivityIndicator.stopAnimating()
// self.myImageView.image = nil;
//});
dispatch_async(dispatch_get_main_queue(),{
self.myActivityIndicator.stopAnimating()
self.imageView.image = nil;
});

/*
if let parseJSON = json {
var firstNameValue = parseJSON["firstName"] as? String
println("firstNameValue: \(firstNameValue)")
}
*/

}

task.resume()

}


func createBodyWithParameters(parameters: [String: String]?, filePathKey: String?, imageDataKey: NSData, boundary: String) -> NSData {
let body = NSMutableData();

if parameters != nil {
for (key, value) in parameters! {
body.appendString("--\(boundary)\r\n")
body.appendString("Content-Disposition: form-data; name=\"\(key)\"\r\n\r\n")
body.appendString("\(value)\r\n")
}
}

let filename = "user-profile.jpg"

let mimetype = "image/jpg"

body.appendString("--\(boundary)\r\n")
body.appendString("Content-Disposition: form-data; name=\"\(filePathKey!)\"; filename=\"\(filename)\"\r\n")
body.appendString("Content-Type: \(mimetype)\r\n\r\n")
body.appendData(imageDataKey)
body.appendString("\r\n")



body.appendString("--\(boundary)--\r\n")

return body
}

func generateBoundaryString() -> String {
return "Boundary-\(NSUUID().UUIDString)"
}

ホームページカレンダー

<<- 2022年05月 ->>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 ** ** ** **

↑ PAGE TOP