createThumbnailUploadPhotoFile method
Future<T>
createThumbnailUploadPhotoFile(
- String memberMediumDocumentID,
- String filePath, {
- FeedbackProgress? feedbackProgress,
Implementation
Future<T> createThumbnailUploadPhotoFile(
String memberMediumDocumentID, String filePath,
{FeedbackProgress? feedbackProgress, String? relatedMediumId}) async {
// First, upload the file
var fileInfo = await UploadInfo.uploadFile(memberMediumDocumentID, filePath,
app.documentID, ownerId, packageName, readAccessCustomMetaData(),
homeURL: app.homeURL,
feedbackProgress: (progress) => _feedBackAggregatedProgress(
1, 4, progress,
feedbackProgress: feedbackProgress));
// Second, create the thumbnail
var baseName = BaseNameHelper.baseName(memberMediumDocumentID, filePath);
var thumbnailBaseName =
BaseNameHelper.thumbnailBaseName(memberMediumDocumentID, filePath);
var enrichedPhoto = await MediumData.enrichPhoto(
baseName, thumbnailBaseName, fileInfo.item2);
_feedBackAggregatedProgress(2, 4, 1, feedbackProgress: feedbackProgress);
// Third, upload the thumbnail
var fileInfoThumbnail = await UploadInfo.uploadData(
thumbnailBaseName,
enrichedPhoto.thumbNailData.data,
app.documentID,
ownerId,
packageName,
readAccessCustomMetaData(),
feedbackProgress: (progress) => _feedBackAggregatedProgress(
3, 4, progress,
feedbackProgress: feedbackProgress));
if (fileInfoThumbnail == null) {
throw Exception('fileInfoThumbnail is null');
}
var returnMe = await photoWithThumbnailToMediumModel(memberMediumDocumentID,
baseName, fileInfo.item1, fileInfoThumbnail, enrichedPhoto,
relatedMediumId: relatedMediumId);
_feedBackAggregatedProgress(1, 4, 1, feedbackProgress: feedbackProgress);
return returnMe;
}