mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
Use api path to determine type
This commit is contained in:
parent
5b60785cca
commit
a13e3c2e20
@ -146,8 +146,10 @@ def latest_frame(camera_name):
|
|||||||
|
|
||||||
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
|
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
|
||||||
|
|
||||||
|
extension = os.path.splitext(request.path)[1]
|
||||||
|
|
||||||
ret, img = cv2.imencode(
|
ret, img = cv2.imencode(
|
||||||
".webp", frame, [int(cv2.IMWRITE_WEBP_QUALITY), resize_quality]
|
f".{extension}", frame, [int(cv2.IMWRITE_WEBP_QUALITY), resize_quality]
|
||||||
)
|
)
|
||||||
response = make_response(img.tobytes())
|
response = make_response(img.tobytes())
|
||||||
response.headers["Content-Type"] = "image/webp"
|
response.headers["Content-Type"] = "image/webp"
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export default function CameraImage({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
imgRef.current.src = `${apiHost}api/${name}/latest.jpg?h=${requestHeight}${
|
imgRef.current.src = `${apiHost}api/${name}/latest.webp?h=${requestHeight}${
|
||||||
searchParams ? `&${searchParams}` : ""
|
searchParams ? `&${searchParams}` : ""
|
||||||
}`;
|
}`;
|
||||||
}, [apiHost, name, imgRef, searchParams, requestHeight, config]);
|
}, [apiHost, name, imgRef, searchParams, requestHeight, config]);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ export default function CameraImage({
|
|||||||
if (!config || scaledHeight === 0 || !canvasRef.current) {
|
if (!config || scaledHeight === 0 || !canvasRef.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
img.src = `${apiHost}api/${name}/latest.jpg?h=${scaledHeight}${
|
img.src = `${apiHost}api/${name}/latest.webp?h=${scaledHeight}${
|
||||||
searchParams ? `&${searchParams}` : ""
|
searchParams ? `&${searchParams}` : ""
|
||||||
}`;
|
}`;
|
||||||
}, [apiHost, canvasRef, name, img, searchParams, scaledHeight, config]);
|
}, [apiHost, canvasRef, name, img, searchParams, scaledHeight, config]);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export function PolygonCanvas({
|
|||||||
const element = new window.Image();
|
const element = new window.Image();
|
||||||
element.width = width;
|
element.width = width;
|
||||||
element.height = height;
|
element.height = height;
|
||||||
element.src = `${apiHost}api/${camera}/latest.jpg`;
|
element.src = `${apiHost}api/${camera}/latest.webp`;
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}, [camera, width, height, apiHost]);
|
}, [camera, width, height, apiHost]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user