/** * Supported image MIME types */ export declare const SUPPORTED_IMAGE_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml", "image/bmp"]; export type SupportedImageType = (typeof SUPPORTED_IMAGE_TYPES)[number]; /** * Validation result for image files */ export interface ImageValidationResult { valid: boolean; error?: string; mimeType?: string; } /** * Validates an image file by MIME type * * @param file - The file to validate * @param allowedTypes - Optional array of allowed MIME types (defaults to SUPPORTED_IMAGE_TYPES) * @returns Validation result with error message if invalid * * @example * ```tsx * const handleFileSelect = (e: React.ChangeEvent) => { * const file = e.target.files?.[0]; * if (!file) return; * * const result = validateImageFile(file); * if (!result.valid) { * alert(result.error); * return; * } * * const url = URL.createObjectURL(file); * // Use the url with image editor * }; * ``` */ export declare function validateImageFile(file: File, allowedTypes?: readonly string[]): ImageValidationResult; /** * Creates a validated object URL from a file * * @param file - The file to create URL from * @param allowedTypes - Optional array of allowed MIME types * @returns Object URL if valid, null if invalid * * @example * ```tsx * const handleFileSelect = async (e: React.ChangeEvent) => { * const file = e.target.files?.[0]; * const result = createValidatedImageURL(file); * * if (!result.url) { * alert(result.error); * return; * } * * setImageUrl(result.url); * }; * ``` */ export declare function createValidatedImageURL(file: File | null | undefined, allowedTypes?: readonly string[]): { url: string | null; error?: string; mimeType?: string; };