save model icon as png

This commit is contained in:
Khanh Le 2024-09-15 16:43:42 +07:00
parent 5dd6ae6ec4
commit 253791b92c
3 changed files with 7 additions and 7 deletions

View File

@ -322,7 +322,7 @@
> >
<div class=" self-start w-8 pt-0.5"> <div class=" self-start w-8 pt-0.5">
<div <div
class=" rounded-full bg-stone-700 {(model?.info?.meta?.hidden ?? false) class=" rounded-full object-cover {(model?.info?.meta?.hidden ?? false)
? 'brightness-90 dark:brightness-50' ? 'brightness-90 dark:brightness-50'
: ''} " : ''} "
> >

View File

@ -309,7 +309,7 @@
ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight); ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight);
// Get the base64 representation of the compressed image // Get the base64 representation of the compressed image
const compressedSrc = canvas.toDataURL('image/jpeg'); const compressedSrc = canvas.toDataURL();
// Display the compressed image // Display the compressed image
info.meta.profile_image_url = compressedSrc; info.meta.profile_image_url = compressedSrc;
@ -321,7 +321,7 @@
if ( if (
inputFiles && inputFiles &&
inputFiles.length > 0 && inputFiles.length > 0 &&
['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ['image/gif', 'image/webp', 'image/jpeg', 'image/png', 'image/svg+xml'].includes(inputFiles[0]['type'])
) { ) {
reader.readAsDataURL(inputFiles[0]); reader.readAsDataURL(inputFiles[0]);
} else { } else {
@ -366,7 +366,7 @@
<button <button
class=" {info.meta.profile_image_url class=" {info.meta.profile_image_url
? '' ? ''
: 'p-4'} rounded-full dark:bg-gray-700 border border-dashed border-gray-200 flex items-center" : 'p-4'} rounded-full border border-dashed border-gray-200 flex items-center"
type="button" type="button"
on:click={() => { on:click={() => {
filesInputElement.click(); filesInputElement.click();

View File

@ -237,7 +237,7 @@
ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight); ctx.drawImage(img, offsetX, offsetY, newWidth, newHeight);
// Get the base64 representation of the compressed image // Get the base64 representation of the compressed image
const compressedSrc = canvas.toDataURL('image/jpeg'); const compressedSrc = canvas.toDataURL();
// Display the compressed image // Display the compressed image
info.meta.profile_image_url = compressedSrc; info.meta.profile_image_url = compressedSrc;
@ -249,7 +249,7 @@
if ( if (
inputFiles && inputFiles &&
inputFiles.length > 0 && inputFiles.length > 0 &&
['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ['image/gif', 'image/webp', 'image/jpeg', 'image/png', 'image/svg+xml'].includes(inputFiles[0]['type'])
) { ) {
reader.readAsDataURL(inputFiles[0]); reader.readAsDataURL(inputFiles[0]);
} else { } else {
@ -294,7 +294,7 @@
<button <button
class=" {info.meta.profile_image_url class=" {info.meta.profile_image_url
? '' ? ''
: 'p-4'} rounded-full dark:bg-gray-700 border border-dashed border-gray-200 flex items-center" : 'p-4'} rounded-full border border-dashed border-gray-200 flex items-center"
type="button" type="button"
on:click={() => { on:click={() => {
filesInputElement.click(); filesInputElement.click();