Added metadata for uploaded images, added confirmation log for the firebase function

This commit is contained in:
Mariano Uvalle 2019-04-07 18:32:32 -05:00
parent 6865399151
commit f438df4432
2 changed files with 5 additions and 1 deletions

View file

@ -44,6 +44,7 @@ export const generateThumb = functions.storage.object().onFinalize(async object
await bucket.upload(thumbnailLocalPath, { await bucket.upload(thumbnailLocalPath, {
destination: join(bucketDirectory, thumbnailName), destination: join(bucketDirectory, thumbnailName),
}); });
console.log('Thumbnail created successfully')
// Exit the function deleting all the temprorary files. // Exit the function deleting all the temprorary files.
return fs.remove(workingDirectory); return fs.remove(workingDirectory);

View file

@ -32,7 +32,10 @@ class FirebaseStorageProvider {
final String fileId = _uuid.v1(); final String fileId = _uuid.v1();
final StorageReference fileReference = final StorageReference fileReference =
_storage.child('$folder$fileId.$type'); _storage.child('$folder$fileId.$type');
return fileReference.putFile(file); return fileReference.putFile(
file,
StorageMetadata(contentType: 'image'),
);
} }
/// Deletes a file from the firebase storage bucket given its path. /// Deletes a file from the firebase storage bucket given its path.