我正在尝试将jpeg上传到服务器。文件上传很好,但元数据丢失,无法查看。当我将图像下载到我的桌面时,它只显示文件关联。如果我在photoshop中打开它,我可以看到图像。一旦我保存它,它工作正常。
我正在使用Retrofit 1.8上传图片。我正在使用SoundCloud Crop裁剪图像。
在我上传它之前,我已经尝试在android中读取exif数据,但是真正形成android是因为它有许多api螺旋起来的android,我的意思是水平。
Php报道
[2017年6月30日22:05:25欧洲/都柏林] PHP警告:exif_read_data(jrProfile_1_profile_image.jpg):/home/jamroom/sites/theflirtapp.com/public_html/modules/jrOpus/account不支持文件第87行的.php [3]
private void changeAvatar() {
List<Intent> otherImageCaptureIntents = new ArrayList<>();
List<ResolveInfo> otherImageCaptureActivities = getPackageManager()
.queryIntentActivities(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), 0);
for (ResolveInfo info : otherImageCaptureActivities) {
Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
captureIntent.setClassName(info.activityInfo.packageName, info.activityInfo.name);
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempOutputFile));
otherImageCaptureIntents.add(captureIntent);
}
Intent selectImageIntent = new Intent(Intent.ACTION_PICK);
selectImageIntent.setType("image/*");
Intent chooser = Intent.createChooser(selectImageIntent, "Choose Avatar");
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, otherImageCaptureIntents.toArray(new Parcelable[otherImageCaptureActivities.size()]));
startActivityForResult(chooser, REQUEST_SELECT_IMAGE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) {
tempOutputFile.delete();
return;
}
if (requestCode == REQUEST_SELECT_IMAGE) {
Uri outputFile;
Uri tempFileUri = Uri.fromFile(tempOutputFile);
if(data != null && (data.getAction() == null || !data.getAction().equals(MediaStore.ACTION_IMAGE_CAPTURE))) {
outputFile = data.getData();
}
else {
outputFile = tempFileUri;
}
new Crop(outputFile)
.asSquare()
.output(tempFileUri)
.start(this);
}
else if (requestCode == Crop.REQUEST_CROP) {
avatarProgressFrame.setVisibility(View.VISIBLE);
bus.post(new Account.ChangeAvatarRequest(Uri.fromFile(tempOutputFile)));
}
}
这是$ _FILES
中收到的数组Array (
[image] => Array (
[name] => temp-image.jpg
[type] => image/jpeg
[tmp_name] => /tmp/jrwQIld9
[size] => 231047
[error] => 0
)
)