Skip to content

Commit

Permalink
[bugfix] unable to upload image data
Browse files Browse the repository at this point in the history
  • Loading branch information
klesh committed Apr 6, 2020
1 parent 3ae1fc2 commit dfa104f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/uploadservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ void UploadService::upload(QList<Clip> &clips)

// build up job list
for (auto &clip : clips) {
clip.freePixmap(); // no need pixmap anymore, free it up
QByteArray imageBytes;

if (clip.isImage && (imageCompressionEanbled || imageWartermarkEnabled)) {
if (clip.isImage && (!clip.isFile || imageCompressionEanbled || imageWartermarkEnabled)) {
// detect format and initialize quality
QByteArray fmt = "jpg";
int quality = -1;
Expand Down Expand Up @@ -101,6 +100,7 @@ void UploadService::upload(QList<Clip> &clips)
buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, fmt, quality);
}
clip.freePixmap(); // no need pixmap anymore, free it up

for (auto &server : servers) {
UploadJob job;
Expand Down
2 changes: 1 addition & 1 deletion src/models/clip.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Clip
if (isFile) {
_pixmap.load(data.toUrl().toLocalFile());
} else {
_pixmap = qvariant_cast<QPixmap>(data);
_pixmap = QPixmap::fromImage(qvariant_cast<QImage>(data));
}
return _pixmap;
}
Expand Down

0 comments on commit dfa104f

Please sign in to comment.