我正在尝试检测用户通过iPhone上传到我网站的照片来源。我想查看它是在实时照片拍摄后上传还是从库中的照片中选择。我想用php检测这个..这可能吗?
答案 0 :(得分:0)
(BOOL)startMediaBrowserFromViewController:(UIViewController *)控制器 usingDelegate:(id)委托{
if(([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum] ==否) || (代表==无) || (控制器==无)) 返回NO;
UIImagePickerController * mediaUI = [[UIImagePickerController alloc] init]; mediaUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
//显示已保存的图片和电影(如果两者都可用) //相机胶卷相册。 mediaUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeSavedPhotosAlbum];
//隐藏移动和控制的控件缩放图片,或用于 //修剪电影。要显示控件,请使用YES。 mediaUI.allowsEditing = NO;
mediaUI.delegate = delegate;
[controller presentModalViewController:mediaUI animated:YES]; 返回YES; }
(IBAction)showSavedMediaBrowser { [self startMediaBrowserFromViewController:self usingDelegate:self]; }
(void)imagePickerController:(UIImagePickerController *)选取器 didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString * mediaType = [info objectForKey:UIImagePickerControllerMediaType]; UIImage * originalImage,* editedImage,* imageToUse;
//处理从相册中挑选的静止图像 if(CFStringCompare((CFStringRef)mediaType,kUTTypeImage,0) == kCFCompareEqualTo){
editedImage = (UIImage *) [info objectForKey:
UIImagePickerControllerEditedImage];
originalImage = (UIImage *) [info objectForKey:
UIImagePickerControllerOriginalImage];
if (editedImage) {
imageToUse = editedImage;
} else {
imageToUse = originalImage;
}
// Do something with imageToUse
}
//处理从相册中挑选的动画 if(CFStringCompare((CFStringRef)mediaType,kUTTypeMovie,0) == kCFCompareEqualTo){
NSString *moviePath = [[info objectForKey:
UIImagePickerControllerMediaURL] path];
// Do something with the picked movie available at moviePath
}
[[picker parentViewController] dismissModalViewControllerAnimated:YES]; [选择器发布]; }