https://github.com/owahab/paperclip-ffmpeg 自动提取视频缩略图,还可以转换视频格式
https://github.com/thoughtbot/paperclip/ 上传文件以及生成缩略图
https://github.com/thoughtbot/paperclip/ 上传文件以及生成缩略图
1633 int QTextEngine::findItem(int strPos) const
1634 {
1635 itemize();
1636 int left = 1;
1637 int right = layoutData->items.size()-1;
1638 while(left <= right) {
1639 int middle = ((right-left)/2)+left;
1640 if (strPos > layoutData->items[middle].position)
1641 left = middle+1;
1642 else if(strPos < layoutData->items[middle].position)
1643 right = middle-1;
1644 else {
1645 return middle;
1646 }
1647 }
1634 {
1635 itemize();
1636 int left = 1;
1637 int right = layoutData->items.size()-1;
1638 while(left <= right) {
1639 int middle = ((right-left)/2)+left;
1640 if (strPos > layoutData->items[middle].position)
1641 left = middle+1;
1642 else if(strPos < layoutData->items[middle].position)
1643 right = middle-1;
1644 else {
1645 return middle;
1646 }
1647 }
排云鹤(281559411) 18:46:20
NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000"];//POST
NSURLRequest *request = [[AFHTTPClient clientWithBaseURL:url] multipartFormRequestWithMethod:@"POST" path:@"mtvs.json" parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"14", @"mtv[user_id]", @"abcddeexxxxxxxxxxxx", @"mtv[title]", @"adfkajdkfjkasdf", @"mtv[description]", nil] constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileURL:[NSURL fileURLWithPath:@"/Users/cheetah/Downloads/copyright.mp4"] name:@"mtv[video]" error:nil];
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSLog(@"%@", str);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@", error);
}];
[operation start];
NSURLRequest *request = [[AFHTTPClient clientWithBaseURL:url] multipartFormRequestWithMethod:@"POST" path:@"mtvs.json" parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"14", @"mtv[user_id]", @"abcddeexxxxxxxxxxxx", @"mtv[title]", @"adfkajdkfjkasdf", @"mtv[description]", nil] constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileURL:[NSURL fileURLWithPath:@"/Users/cheetah/Downloads/copyright.mp4"] name:@"mtv[video]" error:nil];
}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSLog(@"%@", str);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@", error);
}];
[operation start];
// NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000/login.json"];
// NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000/signup.json"];
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
// [request setHTTPMethod:@"POST"];
//
// NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"wcrane23", @"name", @"asss@a.aaaaaaa", @"email", @"lishan", @"password", nil];
// NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
// [request setHTTPBody: data];
// [request setValue:[NSString stringWithFormat:@"%d", data.length] forHTTPHeaderField: @"Content-Length"];
// [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
// [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
//
// NSHTTPURLResponse *response;
// NSData *recData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
// NSString *json = [NSJSONSerialization JSONObjectWithData:recData options:NSJSONReadingAllowFragments error:nil];
// NSLog(@"%@", json);
// NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000/signup.json"];
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
// [request setHTTPMethod:@"POST"];
//
// NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"wcrane23", @"name", @"asss@a.aaaaaaa", @"email", @"lishan", @"password", nil];
// NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
// [request setHTTPBody: data];
// [request setValue:[NSString stringWithFormat:@"%d", data.length] forHTTPHeaderField: @"Content-Length"];
// [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
// [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
//
// NSHTTPURLResponse *response;
// NSData *recData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
// NSString *json = [NSJSONSerialization JSONObjectWithData:recData options:NSJSONReadingAllowFragments error:nil];
// NSLog(@"%@", json);