You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Image Processing
Retrieving Image Information (iOS SDK)
Copy page
Download PDF
Retrieving Image Information (iOS SDK)
The image information retrieval function can obtain the basic attributes of an image, including its height, width, size, and format. If the image contains Exif information, the content will be returned as a JSON string.​
Sample Code​
The following code demonstrates how to retrieve image information.​
​
​
TOSCredential *credential = [[TOSCredential alloc] initWithAccessKey:@"accesskey" secretKey:@"secretkey" securityToken:@"securityToken"];​
TOSEndpoint *tosEndpoint = [[TOSEndpoint alloc] initWithURLString:@"endpoint" withRegion:@"region"];​
TOSClientConfiguration *config = [[TOSClientConfiguration alloc] initWithEndpoint:tosEndpoint credential:credential];​
TOSClient *client = [[TOSClient alloc] initWithConfiguration:config];​
​
TOSGetObjectInput *get = [TOSGetObjectInput new];​
get.tosBucket = @"bucket-name";​
get.tosKey = @"image-name";​
get.tosProcess = @"image/info";​
TOSTask *task = [client getObject:get];​
[task continueWithBlock:^id _Nullable(TOSTask * _Nonnull t) {​
if (!task.error) {​
NSLog(@"Get object success.");​
​
TOSGetObjectOutput *out = t.result;​
NSLog(@"%@", [[NSString alloc] initWithData:out.tosContent encoding:NSUTF8StringEncoding]);​
} else {​
NSLog(@"Get object failed, error: %@" ,task.error);​
}​
return nil;​
}];​
​
Relevant Documentation​
For a detailed introduction to obtaining image information, please refer to Obtain Information.​
Last updated: 2025.09.25 16:40:50