diff --git a/resources/ts/bo/components/ImageInputComponent.vue b/resources/ts/bo/components/ImageInputComponent.vue index 9fe06fe..db59008 100644 --- a/resources/ts/bo/components/ImageInputComponent.vue +++ b/resources/ts/bo/components/ImageInputComponent.vue @@ -1,389 +1,388 @@ + + - + exportCropperFile() { + this.inThasModdedImage = true; + if (!this.inTcropper) { + return; + } + this.inTvalue = this.inTcropper + .getCroppedCanvas({ + fillColor: "rgba(0, 0, 0, 0)", + width: this.inTwidth, + height: this.inTheight, + imageSmoothingEnabled: true, + imageSmoothingQuality: "high", + }) + .toDataURL("image/png"); + this.exportToBlob(); + }, + exportToBlob() { + const self = this, + actualImage = this.$refs.actualImage as HTMLInputElement, + container = new DataTransfer(); + if (!actualImage.files) { + throw new Error("2- missing files list"); + } + this.fetchDataUrlImageSizes(self.inTvalue); + const file = new File( + [self.dataURLtoBlob(self.inTvalue)], + self.inToriginalFileName, + { + type: "image/png", + lastModified: new Date().getTime(), + } + ); + this.inToriginalFile = file; + this.$emit("imageFile", file); + container.items.add(file); + actualImage.files = container.files; + }, + humanFileSize(sizeBytes: number | bigint): string { + let size = Math.abs(Number(sizeBytes)); - + .preview-img { + position: relative; + & > div { + position: relative; + overflow: hidden; + border: 1px solid black; + top: 50%; + left: 50%; + transform: translateX(-50%) translateY(-50%); + } + } + input.right-aligned { + direction: ltr !important; + overflow: hidden !important; + } + input.right-aligned:not(:focus) { + direction: rtl !important; + text-align: left !important; + text-overflow: ellipsis !important; + } +} +