createThumbnailUploadPhotoData method
Future<T>
createThumbnailUploadPhotoData(
- String memberMediumDocumentId,
- Uint8List fileData,
- String baseName,
- String thumbnailBaseName, {
- FeedbackProgress? feedbackProgress,
Implementation
Future<T> createThumbnailUploadPhotoData(String memberMediumDocumentId,
Uint8List fileData, String baseName, String thumbnailBaseName,
{FeedbackProgress? feedbackProgress, String? relatedMediumId}) async {
// First, upload the file
var fileInfo = await UploadInfo.uploadData(baseName, fileData,
app.documentID, ownerId, packageName, readAccessCustomMetaData(),
feedbackProgress: (progress) => _feedBackAggregatedProgress(
1, 4, progress,
feedbackProgress: feedbackProgress));
if (fileInfo == null) {
throw Exception('fileInfo is null');
}
// Second, create the thumbnail
var enrichedPhoto =
await MediumData.enrichPhoto(baseName, thumbnailBaseName, fileData);
_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, fileInfoThumbnail, enrichedPhoto,
relatedMediumId: relatedMediumId);
_feedBackAggregatedProgress(4, 4, 1, feedbackProgress: feedbackProgress);
return returnMe;
}