Merge branch 'krille/send-image-size' into 'master'

Make thumbnailsize configurable

See merge request famedly/famedlysdk!271
This commit is contained in:
Christian Pauly 2020-05-04 06:51:55 +00:00
commit ed86466a19

View file

@ -478,6 +478,7 @@ class Room {
Event inReplyTo, Event inReplyTo,
Map<String, dynamic> info, Map<String, dynamic> info,
bool waitUntilSent = false, bool waitUntilSent = false,
int thumbnailSize = Client.defaultThumbnailSize,
}) async { }) async {
Image fileImage; Image fileImage;
Image thumbnailImage; Image thumbnailImage;
@ -506,7 +507,7 @@ class Room {
thumbnailPathParts.last = 'thumbnail_' + thumbnailPathParts.last + '.jpg'; thumbnailPathParts.last = 'thumbnail_' + thumbnailPathParts.last + '.jpg';
final thumbnailPath = thumbnailPathParts.join('/'); final thumbnailPath = thumbnailPathParts.join('/');
thumbnail = MatrixFile(bytes: file.bytes, path: thumbnailPath); thumbnail = MatrixFile(bytes: file.bytes, path: thumbnailPath);
await thumbnail.resize(width: Client.defaultThumbnailSize); await thumbnail.resize(width: thumbnailSize);
fileImage = decodeImage(file.bytes.toList()); fileImage = decodeImage(file.bytes.toList());
thumbnailImage = decodeImage(thumbnail.bytes.toList()); thumbnailImage = decodeImage(thumbnail.bytes.toList());
} }