mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
Merge pull request #18506 from duncansmart/patch-1
perf: compressImage - preserve image type
This commit is contained in:
commit
92f359fb9b
1 changed files with 2 additions and 1 deletions
|
|
@ -348,7 +348,8 @@ export const compressImage = async (imageUrl, maxWidth, maxHeight) => {
|
||||||
context.drawImage(img, 0, 0, width, height);
|
context.drawImage(img, 0, 0, width, height);
|
||||||
|
|
||||||
// Get compressed image URL
|
// Get compressed image URL
|
||||||
const compressedUrl = canvas.toDataURL();
|
const mimeType = imageUrl.match(/^data:([^;]+);/)?.[1];
|
||||||
|
const compressedUrl = canvas.toDataURL(mimeType);
|
||||||
resolve(compressedUrl);
|
resolve(compressedUrl);
|
||||||
};
|
};
|
||||||
img.onerror = (error) => reject(error);
|
img.onerror = (error) => reject(error);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue