Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api-tests/core/upload/admin/file-image.test.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ describe('Upload', () => {
ext: '.png',
mime: 'image/png',
size: expect.any(Number),
sizeInBytes: expect.any(Number),
width: expect.any(Number),
height: expect.any(Number),
url: expect.any(String),
Expand Down
1 change: 1 addition & 0 deletions api-tests/core/upload/content-api/upload.test.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ describe('Upload plugin', () => {
ext: '.png',
mime: 'image/png',
size: expect.any(Number),
sizeInBytes: expect.any(Number),
width: expect.any(Number),
height: expect.any(Number),
url: expect.any(String),
Expand Down
5 changes: 3 additions & 2 deletions packages/core/upload/server/services/image-manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const resizeFileTo = async (file, options, { name, hash }) => {

const { width, height, size } = await getMetadata(newFile);

Object.assign(newFile, { width, height, size: bytesToKbytes(size) });
Object.assign(newFile, { width, height, size: bytesToKbytes(size), sizeInBytes: size });
return newFile;
};

Expand Down Expand Up @@ -112,13 +112,14 @@ const optimize = async (file) => {

if (newSize > size) {
// Ignore optimization if output is bigger than original
return { ...file, width, height, size: bytesToKbytes(size) };
return { ...file, width, height, size: bytesToKbytes(size), sizeInBytes: size };
}

return Object.assign(newFile, {
width: newWidth,
height: newHeight,
size: bytesToKbytes(newSize),
sizeInBytes: newSize,
});
};

Expand Down