mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Added ability to send webp as compressed image.
This commit is contained in:
@@ -915,7 +915,8 @@ void FileLoadTask::process(Args &&args) {
|
||||
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(w), MTP_int(h)));
|
||||
|
||||
if (ValidateThumbDimensions(w, h)) {
|
||||
isSticker = Core::IsMimeSticker(filemime)
|
||||
isSticker = (_type == SendMediaType::File)
|
||||
&& Core::IsMimeSticker(filemime)
|
||||
&& (filesize < Storage::kMaxStickerBytesSize)
|
||||
&& (Core::IsMimeStickerAnimated(filemime)
|
||||
|| GoodStickerDimensions(w, h));
|
||||
@@ -936,6 +937,9 @@ void FileLoadTask::process(Args &&args) {
|
||||
attributes.push_back(MTP_documentAttributeAnimated());
|
||||
} else if (filemime.startsWith(u"image/"_q)
|
||||
&& _type != SendMediaType::File) {
|
||||
if (Core::IsMimeSticker(filemime)) {
|
||||
fullimage = Images::Opaque(std::move(fullimage));
|
||||
}
|
||||
auto medium = (w > 320 || h > 320) ? fullimage.scaled(320, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation) : fullimage;
|
||||
|
||||
const auto downscaled = (w > 1280 || h > 1280);
|
||||
|
@@ -145,7 +145,8 @@ MimeDataState ComputeMimeDataState(const QMimeData *data) {
|
||||
return MimeDataState::None;
|
||||
}
|
||||
|
||||
const auto imageExtensions = Ui::ImageExtensions();
|
||||
auto imageExtensions = Ui::ImageExtensions();
|
||||
imageExtensions.push_back(u".webp"_q);
|
||||
auto files = QStringList();
|
||||
auto allAreSmallImages = true;
|
||||
for (const auto &url : urls) {
|
||||
@@ -303,11 +304,11 @@ void PrepareDetails(PreparedFile &file, int previewWidth) {
|
||||
if (const auto image = std::get_if<Image>(
|
||||
&file.information->media)) {
|
||||
Assert(!image->data.isNull());
|
||||
if (ValidPhotoForAlbum(*image, file.information->filemime)) {
|
||||
if (ValidPhotoForAlbum(*image, file.information->filemime)
|
||||
|| Core::IsMimeSticker(file.information->filemime)) {
|
||||
UpdateImageDetails(file, previewWidth);
|
||||
file.type = PreparedFile::Type::Photo;
|
||||
} else if (Core::IsMimeSticker(file.information->filemime)
|
||||
|| image->animated) {
|
||||
} else if (image->animated) {
|
||||
file.type = PreparedFile::Type::None;
|
||||
}
|
||||
} else if (const auto video = std::get_if<Video>(
|
||||
|
Reference in New Issue
Block a user