{"action":"created","issue":{"url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/193","repository_url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios","labels_url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/193/labels{/name}","comments_url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/193/comments","events_url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/193/events","html_url":"https://github.com/QuickBlox/q-municate-services-ios/issues/193","id":149957326,"number":193,"title":"Send Image file problem","user":{"login":"nichman","id":4599618,"avatar_url":"https://avatars.githubusercontent.com/u/4599618?v=3","gravatar_id":"","url":"https://api.github.com/users/nichman","html_url":"https://github.com/nichman","followers_url":"https://api.github.com/users/nichman/followers","following_url":"https://api.github.com/users/nichman/following{/other_user}","gists_url":"https://api.github.com/users/nichman/gists{/gist_id}","starred_url":"https://api.github.com/users/nichman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nichman/subscriptions","organizations_url":"https://api.github.com/users/nichman/orgs","repos_url":"https://api.github.com/users/nichman/repos","events_url":"https://api.github.com/users/nichman/events{/privacy}","received_events_url":"https://api.github.com/users/nichman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-21T03:54:06Z","updated_at":"2016-04-21T09:08:32Z","closed_at":null,"body":"From quickbox demo app. I can upload image by following code.\r\n\r\n```objectivec\r\n- (void)didPickAttachmentImage:(UIImage *)image {\r\n    \r\n    QBChatMessage* message = [QBChatMessage new];\r\n    message.senderID = self.senderID;\r\n    message.dialogID = self.dialog.ID;\r\n    message.dateSent = [NSDate date];\r\n    message.markable = YES;\r\n\r\n    \r\n    //__weak typeof(self)weakSelf = self;\r\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\r\n      //  __typeof(weakSelf)strongSelf = weakSelf;\r\n        UIImage* newImage = image;\r\n        if (self.pickerController.sourceType == UIImagePickerControllerSourceTypeCamera) {\r\n            //newImage = [newImage fixOrientation];\r\n        }\r\n        \r\n        UIImage* resizedImage = [self resizedImageFromImage:newImage];\r\n        \r\n        // Sending attachment to dialog.\r\n        dispatch_async(dispatch_get_main_queue(), ^{\r\n            [[ServicesManager instance].chatService sendAttachmentMessage:message\r\n                                                                 toDialog:self.dialog\r\n                                                      withAttachmentImage:resizedImage\r\n                                                               completion:^(NSError *error) {\r\n                                                                   \r\n                                                                   [self.attachmentCells removeObjectForKey:message.ID];\r\n                                                                   \r\n                                                                   if (error != nil) {\r\n                                                                       [SVProgressHUD showErrorWithStatus:error.localizedDescription];\r\n                                                                       \r\n                                                                       // perform local attachment deleting\r\n                                                                       [[ServicesManager instance].chatService deleteMessageLocally:message];\r\n                                                                       [self.chatSectionManager deleteMessage:message];\r\n                                                                   }\r\n                                                               }];\r\n        });\r\n    });\r\n}\r\n\r\n`-` (UIImage *)resizedImageFromImage:(UIImage *)image {\r\n    \r\n    CGFloat largestSide = image.size.width > image.size.height ? image.size.width : image.size.height;\r\n    CGFloat scaleCoefficient = largestSide / 560.0f;\r\n    CGSize newSize = CGSizeMake(image.size.width / scaleCoefficient, image.size.height / scaleCoefficient);\r\n    \r\n    UIGraphicsBeginImageContext(newSize);\r\n    \r\n    [image drawInRect:(CGRect){0, 0, newSize.width, newSize.height}];\r\n    UIImage* resizedImage = UIGraphicsGetImageFromCurrentImageContext();\r\n    \r\n    UIGraphicsEndImageContext();\r\n    \r\n    return resizedImage;\r\n}\r\n```\r\n\r\n![screen shot 2559-04-21 at 10 34 49](https://cloud.githubusercontent.com/assets/4599618/14697558/215849da-07af-11e6-972c-c4a8e39431d9.png)\r\n\r\n\r\nWhen upload finish, image filename in server is attachment\\. but Chat log can't see image and load image."},"comment":{"url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/comments/212822580","html_url":"https://github.com/QuickBlox/q-municate-services-ios/issues/193#issuecomment-212822580","issue_url":"https://api.github.com/repos/QuickBlox/q-municate-services-ios/issues/193","id":212822580,"user":{"login":"nichman","id":4599618,"avatar_url":"https://avatars.githubusercontent.com/u/4599618?v=3","gravatar_id":"","url":"https://api.github.com/users/nichman","html_url":"https://github.com/nichman","followers_url":"https://api.github.com/users/nichman/followers","following_url":"https://api.github.com/users/nichman/following{/other_user}","gists_url":"https://api.github.com/users/nichman/gists{/gist_id}","starred_url":"https://api.github.com/users/nichman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nichman/subscriptions","organizations_url":"https://api.github.com/users/nichman/orgs","repos_url":"https://api.github.com/users/nichman/repos","events_url":"https://api.github.com/users/nichman/events{/privacy}","received_events_url":"https://api.github.com/users/nichman/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T09:08:32Z","updated_at":"2016-04-21T09:08:32Z","body":"I can send text message successful(Message was shown in history on QuickBox Dashboard) but when I send image message. Image was uploaded successful to server but did not show in Message Histrory.\r\n\r\nThese is an log when upload image.\r\n\r\n> 2016-04-21 15:53:22.359 Boonthavorn[31643:152763] [QBCore] Request URL:https://api.quickblox.com/blobs.json\r\n2016-04-21 15:53:22.359 Boonthavorn[31643:152763] [QBCore] Request method: POST\r\n2016-04-21 15:53:22.360 Boonthavorn[31643:152763] [QBCore] Request parameters:{\r\n    blob =     {\r\n        \"content_type\" = \"image/png\";\r\n        name = attachment;\r\n    };\r\n}\r\n2016-04-21 15:53:22.361 Boonthavorn[31643:152763] [QBCore] Request headers: {\r\n    \"Content-Type\" = \"application/json\";\r\n    \"QB-OS\" = \"iOS 9.3\";\r\n    \"QB-SDK\" = \"iOS 2.6.6\";\r\n    \"QB-Token\" = c6ed2e6d7d4c25cc9f5d74a5fbc0fd92933a8e9b;\r\n    \"QuickBlox-REST-API-Version\" = \"0.1.1\";\r\n}\r\n2016-04-21 15:53:22.364 Boonthavorn[31643:152762] Messages to insert 1\r\n2016-04-21 15:53:22.364 Boonthavorn[31643:152762] Messages to update 0\r\n2016-04-21 15:53:22.892 Boonthavorn[31643:152899] [QBCore] Response headers: {\r\n    \"Access-Control-Allow-Origin\" = \"*\";\r\n    \"Cache-Control\" = \"max-age=0, private, must-revalidate\";\r\n    Connection = \"keep-alive\";\r\n    \"Content-Length\" = 1444;\r\n    \"Content-Type\" = \"application/json; charset=utf-8\";\r\n    Date = \"Thu, 21 Apr 2016 08:53:22 GMT\";\r\n    Etag = \"\\\"95cc441f5de511d5806e0a7d1a7d7f9e\\\"\";\r\n    \"QB-Token-ExpirationDate\" = \"2016-04-21 10:51:35 UTC\";\r\n    \"QuickBlox-REST-API-Version\" = \"0.1.1\";\r\n    Server = \"nginx/1.8.1\";\r\n    Status = \"201 Created\";\r\n    \"Strict-Transport-Security\" = \"max-age=15768000;\";\r\n    \"X-Rack-Cache\" = \"invalidate, pass\";\r\n    \"X-Request-Id\" = 9c5bece1447b15cae00ceea797115081;\r\n    \"X-Runtime\" = \"0.240324\";\r\n    \"X-UA-Compatible\" = \"IE=Edge,chrome=1\";\r\n}\r\n2016-04-21 15:53:22.893 Boonthavorn[31643:152899] [QBCore] Response object: {\r\n    blob =     {\r\n        \"account_id\" = 48787;\r\n        \"app_id\" = \"<null>\";\r\n        \"blob_object_access\" =         {\r\n            \"blob_id\" = 4201015;\r\n            expires = \"2016-04-21T09:53:22Z\";\r\n            id = 4201015;\r\n            \"object_access_type\" = Write;\r\n            params = \"https://qbprod.s3.amazonaws.com/?Content-Type=image%2Fpng&Expires=Thu%2C%2021%20Apr%202016%2009%3A53%3A22%20GMT&acl=authenticated-read&key=154d853e9154489a9fc2e8cdcf939e0a00&policy=eyJleHBpcmF0aW9uIjoiMjAxNi0wNC0yMVQwOTo1MzoyMloiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJxYnByb2QifSx7ImFjbCI6ImF1dGhlbnRpY2F0ZWQtcmVhZCJ9LHsiQ29udGVudC1UeXBlIjoiaW1hZ2UvcG5nIn0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSx7IkV4cGlyZXMiOiJUaHUsIDIxIEFwciAyMDE2IDA5OjUzOjIyIEdNVCJ9LHsia2V5IjoiMTU0ZDg1M2U5MTU0NDg5YTlmYzJlOGNkY2Y5MzllMGEwMCJ9LHsieC1hbXotY3JlZGVudGlhbCI6IkFLSUFJWTdLRk0yM1hHWEo3UjdBLzIwMTYwNDIxL3VzLWVhc3QtMS9zMy9hd3M0X3JlcXVlc3QifSx7IngtYW16LWFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IngtYW16LWRhdGUiOiIyMDE2MDQyMVQwODUzMjJaIn1dfQ%3D%3D&success_action_status=201&x-amz-algorithm=AWS4-HMAC-SHA256&x-amz-credential=AKIAIY7KFM23XGXJ7R7A%2F20160421%2Fus-east-1%2Fs3%2Faws4_request&x-amz-date=20160421T085322Z&x-amz-signature=89e109d58e4f9bf1926e1072069bf8189c3b2198b45134ea2c5163cc1d0103fe\";\r\n        };\r\n        \"blob_status\" = \"<null>\";\r\n        \"content_type\" = \"image/png\";\r\n        \"created_at\" = \"2016-04-21T08:53:22Z\";\r\n        id = 4201015;\r\n        \"last_read_access_ts\" = \"<null>\";\r\n        lifetime = 0;\r\n        name = attachment;\r\n        public = 0;\r\n        \"ref_count\" = 1;\r\n        \"set_completed_at\" = \"<null>\";\r\n        size = \"<null>\";\r\n        uid = 154d853e9154489a9fc2e8cdcf939e0a00;\r\n        \"updated_at\" = \"2016-04-21T08:53:22Z\";\r\n    };\r\n}\r\n2016-04-21 15:53:22.894 Boonthavorn[31643:152899] [QBCore] Request URL:https://qbprod.s3.amazonaws.com/\r\n2016-04-21 15:53:22.894 Boonthavorn[31643:152899] [QBCore] Request method: POST\r\n2016-04-21 15:53:22.895 Boonthavorn[31643:152899] [QBCore] Request headers: {\r\n    \"Content-Length\" = 535531;\r\n    \"Content-Type\" = \"multipart/form-data; boundary=Boundary+0xAbCdEfGbOuNdArY\";\r\n    \"QB-OS\" = \"iOS 9.3\";\r\n    \"QB-SDK\" = \"iOS 2.6.6\";\r\n    \"QB-Token\" = c6ed2e6d7d4c25cc9f5d74a5fbc0fd92933a8e9b;\r\n    \"QuickBlox-REST-API-Version\" = \"0.1.1\";\r\n}\r\n2016-04-21 15:53:27.700 Boonthavorn[31643:152763] [QBCore] Response headers: {\r\n    \"Content-Length\" = 270;\r\n    \"Content-Type\" = \"application/xml\";\r\n    Date = \"Thu, 21 Apr 2016 08:53:25 GMT\";\r\n    Etag = \"\\\"02be61650f3f40246e0b6bd0448cd820\\\"\";\r\n    Location = \"https://qbprod.s3.amazonaws.com/154d853e9154489a9fc2e8cdcf939e0a00\";\r\n    Server = AmazonS3;\r\n    \"x-amz-id-2\" = \"XgCwpJin97mQe9ui3x7+xZeps5Z5iCG+UVZE7nfiGmdOv0mjWgL+I7NjsjwSHhWLUdWzSz+nptU=\";\r\n    \"x-amz-request-id\" = 2B9E390D0F62EFFE;\r\n}\r\n2016-04-21 15:53:27.701 Boonthavorn[31643:152763] [QBCore] Response object: <NSXMLParser: 0x7fa85ad3f670>\r\n2016-04-21 15:53:27.701 Boonthavorn[31643:152763] [QBCore] Request URL:https://api.quickblox.com/blobs/4201015/complete.json?blob%5Bsize%5D=533730\r\n2016-04-21 15:53:27.701 Boonthavorn[31643:152763] [QBCore] Request method: PUT\r\n2016-04-21 15:53:27.702 Boonthavorn[31643:152763] [QBCore] Request parameters:{\r\n    blob =     {\r\n        size = 533730;\r\n    };\r\n}\r\n2016-04-21 15:53:27.702 Boonthavorn[31643:152763] [QBCore] Request headers: {\r\n    \"Content-Type\" = \"application/json\";\r\n    \"QB-OS\" = \"iOS 9.3\";\r\n    \"QB-SDK\" = \"iOS 2.6.6\";\r\n    \"QB-Token\" = c6ed2e6d7d4c25cc9f5d74a5fbc0fd92933a8e9b;\r\n    \"QuickBlox-REST-API-Version\" = \"0.1.1\";\r\n}\r\n2016-04-21 15:53:28.552 Boonthavorn[31643:152763] [QBCore] Response headers: {\r\n    \"Access-Control-Allow-Origin\" = \"*\";\r\n    \"Cache-Control\" = \"max-age=0, private, must-revalidate\";\r\n    Connection = \"keep-alive\";\r\n    \"Content-Length\" = 1;\r\n    \"Content-Type\" = \"application/json; charset=utf-8\";\r\n    Date = \"Thu, 21 Apr 2016 08:53:28 GMT\";\r\n    Etag = \"\\\"7215ee9c7d9dc229d2921a40e899ec5f\\\"\";\r\n    \"QB-Token-ExpirationDate\" = \"2016-04-21 10:51:35 UTC\";\r\n    \"QuickBlox-REST-API-Version\" = \"0.1.1\";\r\n    Server = \"nginx/1.8.1\";\r\n    Status = \"200 OK\";\r\n    \"Strict-Transport-Security\" = \"max-age=15768000;\";\r\n    \"X-Rack-Cache\" = \"invalidate, pass\";\r\n    \"X-Request-Id\" = 3caa5547d08d776ddfa0e42f1703860b;\r\n    \"X-Runtime\" = \"0.454777\";\r\n    \"X-UA-Compatible\" = \"IE=Edge,chrome=1\";\r\n}\r\n2016-04-21 15:53:28.558 Boonthavorn[31643:152530] [ChatService] Message SNT: <message id=\"571895029d808e9b7b0041b6\" type=\"chat\" to=\"18446744073709551615-38483@chat.quickblox.com\"><body>Attachment image</body><extraParams xmlns=\"jabber:client\"><save_to_history>1</save_to_history><date_sent>1461228808</date_sent><attachment type=\"image\" url=\"https://api.quickblox.com/blobs/154d853e9154489a9fc2e8cdcf939e0a00.json?token=c6ed2e6d7d4c25cc9f5d74a5fbc0fd92933a8e9b\" id=\"154d853e9154489a9fc2e8cdcf939e0a00\"/><dialog_id>570b241fa28f9a835d000009</dialog_id></extraParams><markable xmlns=\"urn:xmpp:chat-markers:0\"/></message>\r\n2016-04-21 15:53:28.561 Boonthavorn[31643:152763] [ChatService] StreamManagement: did request acknowledgment\r\n2016-04-21 15:53:29.178 Boonthavorn[31643:152762] [ChatService] StreamManagement: did receive acknowledgments for stanza ids count: 1\r\n2016-04-21 15:53:29.183 Boonthavorn[31643:152763] Messages to insert 0\r\n2016-04-21 15:53:29.183 Boonthavorn[31643:152763] Messages to update 1\r\n2016-04-21 15:53:29.185 Boonthavorn[31643:152763] Dialogs to insert 0\r\n2016-04-21 15:53:29.186 Boonthavorn[31643:152763] Dialogs to update 1\r\n"}}