feat: SOTA Image to Base64 converter with 6 output formats (#65)

* feat(image-to-base64): register tool in shared constants and i18n

* feat(image-to-base64): add API route with Sharp pipeline and base64 encoding

* feat(image-to-base64): add Zustand store for base64 results

* feat(image-to-base64): add settings panel component

* feat(image-to-base64): add results panel with 6-tab output and batch accordion

* feat(image-to-base64): register tool in frontend tool registry

* fix(image-to-base64): pass through original buffer when no resize/conversion needed

---------

Co-authored-by: stirling-image <stirling-image@users.noreply.github.com>
This commit is contained in:
stirling-image
2026-04-14 10:17:19 +08:00
committed by GitHub
co-authored by stirling-image
parent 2f11b9e101
commit 01cbb16cd9
8 changed files with 698 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
import { create } from "zustand";
export interface Base64Result {
filename: string;
mimeType: string;
width: number;
height: number;
originalSize: number;
encodedSize: number;
overheadPercent: number;
base64: string;
dataUri: string;
}
export interface Base64Error {
filename: string;
error: string;
}
interface Base64State {
results: Base64Result[];
errors: Base64Error[];
processing: boolean;
expandedIndex: number;
setResults: (results: Base64Result[], errors: Base64Error[]) => void;
setProcessing: (v: boolean) => void;
setExpandedIndex: (i: number) => void;
reset: () => void;
}
export const useBase64Store = create<Base64State>((set) => ({
results: [],
errors: [],
processing: false,
expandedIndex: 0,
setResults: (results, errors) => set({ results, errors, expandedIndex: 0 }),
setProcessing: (v) => set({ processing: v }),
setExpandedIndex: (i) => set({ expandedIndex: i }),
reset: () => set({ results: [], errors: [], processing: false, expandedIndex: 0 }),
}));