| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/@nuxt/image/dist/runtime/providers/ |
Upload File : |
import {joinURL} from "ufo";
import {createMapper, createOperationsGenerator} from "~image";
const fits = createMapper({
fill: "resize",
inside: "contain-max",
outside: "contain-min",
cover: "cover",
contain: "contain",
missingValue: "cover"
});
const operationsGenerator = createOperationsGenerator({
keyMap: {
format: "output",
quality: "quality",
background: "background",
focus: "focus",
zoom: "zoom"
},
valueMap: {
format(value) {
if (value === "jpg") {
return "jpeg";
}
return value;
},
background(value) {
if (value.startsWith("#")) {
return value.replace("#", "");
}
return value;
},
focus: {
auto: "auto",
faces: "faces",
north: "50px0p",
northEast: "100px0p",
northWest: "0px0p",
west: "0px50p",
southWest: "100px100p",
south: "50px100p",
southEast: "0px100p",
east: "100px50p",
center: "50px50p"
}
},
joinWith: "/",
formatter: (key, value) => `${key}=${value}`
});
export const getImage = (src, {modifiers = {}, baseURL = "/"} = {}) => {
const {width, height, fit, ...providerModifiers} = modifiers;
if (width || height) {
providerModifiers[fits(fit)] = `${width || "-"}x${height || "-"}`;
}
const operations = operationsGenerator(providerModifiers);
return {
url: joinURL(baseURL, src + (operations ? "?twic=v1/" + operations : ""))
};
};