private void prepareForUploadAndDisplay(String imagePath) { String contentType = AndroidIOUtils.getMimeType(imagePath); File imageFile = new File(imagePath); String fileName = imageFile.getName(); ImageDesc imageDesc = new ImageDesc(); imageDesc.setOriginalPath(imagePath); imageDesc.setContentType(contentType); imageDesc.setFileName(fileName); // 如果不是Gif 类型,则根据屏幕高宽生成缩略图 if (!AndroidIOUtils.isGifType(contentType)) { Point screenSize = ScreenUtils.getScreenSize(context); } // Todo 生成用于上传的缩略图 }
private void buildMultipartEntity() { try { for (Map.Entry<String, String> stringEntry : mStringPartMap.entrySet()) { mMultipartEntity.addPart(stringEntry.getKey(), new StringBody(stringEntry.getValue())); } } catch (UnsupportedEncodingException e) { LogUtils.e(LOG_TAG, "UnsupportedEncodingException"); } for (Map.Entry<String, File> fileEntry : mFilePartMap.entrySet()) { File file = fileEntry.getValue(); mMultipartEntity.addPart( fileEntry.getKey(), new FileBody(file, AndroidIOUtils.getMimeType(file.getPath()))); } }