diff --git a/src/assets/css/sendattachments.scss b/src/assets/css/sendattachments.scss
index 43f6c2a..4ffd699 100644
--- a/src/assets/css/sendattachments.scss
+++ b/src/assets/css/sendattachments.scss
@@ -107,6 +107,16 @@ $hiliteColor: #4642f1;
align-items: end;
justify-content: end;
}
+
+ .send-attachments__selecting__current-item__cc {
+ position: absolute;
+ right: 12px;
+ bottom: 12px;
+ display: flex;
+ flex-direction: column;
+ align-items: end;
+ justify-content: end;
+ }
}
.file-drop-thumbnail-container,
diff --git a/src/components/file_mode/SendAttachmentsLayout.vue b/src/components/file_mode/SendAttachmentsLayout.vue
index b1fdf32..ed26912 100644
--- a/src/components/file_mode/SendAttachmentsLayout.vue
+++ b/src/components/file_mode/SendAttachmentsLayout.vue
@@ -28,6 +28,10 @@
+
+ $vuetify.icons.ic_cr
+
+
@@ -85,15 +89,17 @@
:disabled="sendButtonDisabled"
>
-
+
+
+
@@ -283,6 +289,12 @@ export default defineComponent({
}
return undefined;
},
+ anyContainsCC(): boolean {
+ return this.batch.attachments.some((a: Attachment) => a.proof?.integrity?.c2pa !== undefined);
+ },
+ showCCIcon(): boolean {
+ return this.currentAttachment && this.currentAttachment.proof?.integrity?.c2pa !== undefined && !this.currentAttachment.useScaled;
+ }
},
watch: {
"batch.attachments": {
@@ -360,4 +372,10 @@ export default defineComponent({
diff --git a/src/models/attachmentManager.ts b/src/models/attachmentManager.ts
index 544c2d1..6d029fc 100644
--- a/src/models/attachmentManager.ts
+++ b/src/models/attachmentManager.ts
@@ -94,25 +94,24 @@ export class AttachmentManager {
// Need to resize?
const w = attachment.dimensions?.width ?? 0;
const h = attachment.dimensions?.height ?? 0;
- if (w > 640 || h > 640) {
- var aspect = w / h;
- var newWidth = parseInt((w > h ? 640 : 640 * aspect).toFixed());
- var newHeight = parseInt((w > h ? 640 / aspect : 640).toFixed());
- const img = await imageResize(file, {
- format: "webp",
- width: newWidth,
- height: newHeight,
- outputType: "blob",
- });
- attachment.scaledFile = new File([img as BlobPart], file.name, {
- type: "image/webp",
- lastModified: Date.now(),
- });
- attachment.scaledDimensions = {
- width: newWidth,
- height: newHeight,
- };
- }
+ const sizeDown = (w > 640 || h > 640);
+ var aspect = w / h;
+ var newWidth = sizeDown ? parseInt((w > h ? 640 : 640 * aspect).toFixed()) : w;
+ var newHeight = sizeDown ? parseInt((w > h ? 640 / aspect : 640).toFixed()) : h;
+ const compressedImg = await imageResize(file, {
+ format: "webp",
+ width: newWidth,
+ height: newHeight,
+ outputType: "blob",
+ });
+ attachment.scaledFile = new File([compressedImg as BlobPart], file.name, {
+ type: "image/webp",
+ lastModified: Date.now(),
+ });
+ attachment.scaledDimensions = {
+ width: newWidth,
+ height: newHeight,
+ };
} catch (error) {
console.error("Failed to get image dimensions: " + error);
}
@@ -478,7 +477,10 @@ export const createUploadBatch = (manager: AttachmentManager | null, room: Room
const removeAttachment = (attachment: Attachment) => {
if (sendingStatus.value == "initial") {
- attachments.value = attachments.value.filter((a) => a !== attachment);
+ const index = attachments.value.indexOf(attachment);
+ if (index > -1) {
+ attachments.value.splice(index, 1);
+ }
}
};