blob: a87fc4c1582e74f924ac75af9a3d80b7e6b760fd (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import React, { useEffect, useState } from 'react'
import Image from 'next/image'
import path from 'path'
//import '../../../public/placeholder.png'
export interface OrgImageProps {
src: string
file: string
}
export const OrgImage = (props: OrgImageProps) => {
const { src, file } = props
const [image, setImage] = useState<any>(null)
/* )
* .then((res) => res.blob())
* .then((res) => setImage(res))
* .catch((e) => {
* setImage(null)
* console.error(e)
* })
}, [fullPath]) */
const dir = path.dirname(file)
const fullPath = encodeURIComponent(encodeURIComponent(path.join(dir, src)))
const dumbLoader = ({ src, width, quality }: { [key: string]: string | number }) => {
return `http://localhost:35901/img/${src}`
}
return (
<Image layout="responsive" loader={dumbLoader} src={fullPath} alt="" width="70%" height="70%" />
)
}
|