Update 20 euro cent coins edge
This commit is contained in:
BIN
prisma/main.db
BIN
prisma/main.db
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -24,6 +24,16 @@ const asyncSpawn = (command: string, args: string[]) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getEdgeRepeatNumber = (shape?: string) => {
|
||||
switch(shape?.toLowerCase?.()) {
|
||||
case 'spanish flower':
|
||||
return 7;
|
||||
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
const getPreviousResult = async (id: number) => {
|
||||
try {
|
||||
return await readFile(path.join('./public/photos/joined', `${id}.jpg`));
|
||||
@@ -40,6 +50,7 @@ const generateImage = async (id: number) => {
|
||||
}
|
||||
|
||||
const coin = await getType(id);
|
||||
const edgeRepeatNumber = getEdgeRepeatNumber(coin?.shape)
|
||||
|
||||
if (!coin) {
|
||||
return;
|
||||
@@ -55,9 +66,9 @@ const generateImage = async (id: number) => {
|
||||
} else {
|
||||
await asyncSpawn('convert', [
|
||||
'-size',
|
||||
'512x64',
|
||||
'256x256!',
|
||||
`xc:${coin.color}`,
|
||||
path.join('./public/photos/joined', `${id}-edge.jpg`)
|
||||
path.join('./public/photos/joined', `${id}-obverse.jpg`)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -72,9 +83,9 @@ const generateImage = async (id: number) => {
|
||||
} else {
|
||||
await asyncSpawn('convert', [
|
||||
'-size',
|
||||
'512x64',
|
||||
'256x256!',
|
||||
`xc:${coin.color}`,
|
||||
path.join('./public/photos/joined', `${id}-edge.jpg`)
|
||||
path.join('./public/photos/joined', `${id}-reverse.jpg`)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -82,13 +93,13 @@ const generateImage = async (id: number) => {
|
||||
await asyncSpawn('convert', [
|
||||
path.join('./public', coin.edge.picture),
|
||||
'-resize',
|
||||
'512x64!',
|
||||
`512x${256/edgeRepeatNumber}!`,
|
||||
path.join('./public/photos/joined', `${id}-edge.jpg`)
|
||||
]);
|
||||
} else {
|
||||
await asyncSpawn('convert', [
|
||||
'-size',
|
||||
'512x64',
|
||||
`512x${256/edgeRepeatNumber}!`,
|
||||
`xc:${coin.color}`,
|
||||
path.join('./public/photos/joined', `${id}-edge.jpg`)
|
||||
]);
|
||||
@@ -101,7 +112,7 @@ const generateImage = async (id: number) => {
|
||||
path.join('./public/photos/joined', `${id}.jpg`)
|
||||
]);
|
||||
|
||||
for (let index = 0; index < 4; index++) {
|
||||
for (let index = 0; index < edgeRepeatNumber; index++) {
|
||||
await asyncSpawn('convert', [
|
||||
path.join('./public/photos/joined', `${id}.jpg`),
|
||||
path.join('./public/photos/joined', `${id}-edge.jpg`),
|
||||
|
||||
Reference in New Issue
Block a user