-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'developing/2.0.0' of https://github.com/sunnydanu/godev…
….run into feat(yaml-viewer)--add-parsing-validation Merge branch 'developing/2.0.0' of https://github.com/sunnydanu/godev.run into feat(yaml-viewer)--add-parsing-validation
- Loading branch information
Showing
8 changed files
with
786 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PictureInPictureOff } from '@vicons/tabler'; | ||
import { defineTool } from '../tool'; | ||
|
||
export const tool = defineTool({ | ||
name: 'Remove EXIF', | ||
path: '/remove-exif', | ||
description: 'Remove Exif from JPEG Files', | ||
keywords: ['remove', 'exif', 'jpeg'], | ||
component: () => import('./remove-exif.vue'), | ||
icon: PictureInPictureOff, | ||
createdAt: new Date('2024-07-14'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<script setup lang="ts"> | ||
import { Buffer } from 'node:buffer'; | ||
import { Base64 } from 'js-base64'; | ||
import ExifTransformer from 'exif-be-gone'; | ||
import MemoryStream from 'memorystream'; | ||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64'; | ||
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle'); | ||
const file = ref<File | null>(null); | ||
interface ToBufferMemoryStream extends MemoryStream { | ||
toBuffer(): Buffer | ||
} | ||
const base64OutputFile = ref(''); | ||
const fileName = ref(''); | ||
const { download } = useDownloadFileFromBase64( | ||
{ | ||
source: base64OutputFile, | ||
filename: fileName, | ||
extension: 'jpg', | ||
}); | ||
async function onFileUploaded(uploadedFile: File) { | ||
file.value = uploadedFile; | ||
const fileBuffer = await uploadedFile.arrayBuffer(); | ||
fileName.value = `noexif_${uploadedFile.name}`; | ||
status.value = 'processing'; | ||
try { | ||
const inStream = MemoryStream.createReadStream(Buffer.from(fileBuffer)); | ||
const outStream = MemoryStream.createWriteStream(); | ||
const trans = new ExifTransformer(); | ||
await new Promise((resolve, _reject) => { | ||
inStream.pipe(trans).pipe(outStream).on('finish', () => resolve(true)); | ||
}); | ||
const outFileBuffer = (outStream as ToBufferMemoryStream).toBuffer(); | ||
base64OutputFile.value = `data:image/File;base64,${Base64.fromUint8Array(outFileBuffer)}`; | ||
status.value = 'done'; | ||
download(); | ||
} | ||
catch (e) { | ||
status.value = 'error'; | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div style="flex: 0 0 100%"> | ||
<div mx-auto max-w-600px> | ||
<c-file-upload title="Drag and drop a Image file here, or click to select a file" accept="image/*" @file-upload="onFileUploaded" /> | ||
</div> | ||
</div> | ||
|
||
<div mt-3 flex justify-center> | ||
<c-alert v-if="status === 'error'" type="error"> | ||
An error occured processing {{ fileName }} | ||
</c-alert> | ||
<n-spin | ||
v-if="status === 'processing'" | ||
size="small" | ||
/> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters