mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-15 18:32:33 +01:00
27 lines
612 B
TypeScript
27 lines
612 B
TypeScript
import { sanitizePath } from "@common/sanitize-path";
|
|
|
|
const ImageViewer = ({
|
|
imagePath,
|
|
setDimensions,
|
|
}: {
|
|
imagePath: string;
|
|
setDimensions: (dimensions: { width: number; height: number }) => void;
|
|
}) => {
|
|
return (
|
|
<img
|
|
src={"file:///" + sanitizePath(imagePath)}
|
|
onLoad={(e: any) => {
|
|
setDimensions({
|
|
width: e.target.naturalWidth,
|
|
height: e.target.naturalHeight,
|
|
});
|
|
}}
|
|
draggable="false"
|
|
alt=""
|
|
className="h-full w-full bg-gradient-to-br from-base-300 to-base-100 object-contain"
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default ImageViewer;
|