This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/projects/website/src/common/image-utils.ts

24 lines
556 B
TypeScript
Raw Normal View History

2024-10-04 18:25:37 +01:00
import { config } from "../../config";
/**
* Proxies all non-localhost images to make them load faster.
*
* @param originalUrl the original image url
* @returns the new image url
*/
export function getImageUrl(originalUrl: string) {
return `${!config.siteUrl.includes("localhost") ? "https://img.fascinated.cc/upload/q_70/" : ""}${originalUrl}`;
}
/**
* Gets the average color of an image
*
* @param src the image url
* @returns the average color
*/
2024-10-09 17:56:17 +01:00
export const getAverageColor = async (src: string) => {
2024-10-04 21:17:10 +01:00
return {
hex: "#fff",
};
2024-10-09 17:56:17 +01:00
};