Added second album image

This commit is contained in:
2024-10-14 00:07:31 -03:00
parent 48030a035e
commit 19d8322dfc
7 changed files with 204 additions and 95 deletions

View File

@@ -41,6 +41,7 @@ export const entryRouter = createTRPCRouter({
type: z.enum(["artist", "album"]),
name: z.string().min(1),
image: z.string().min(1),
number: z.number().optional(),
}),
}),
)
@@ -51,7 +52,7 @@ export const entryRouter = createTRPCRouter({
if (!uploadedImage || typeof uploadedImage !== "string") {
throw new Error("Failed to upload image");
}
const spookyImage = makeImageSpooky(uploadedImage);
const spookyImage = makeImageSpooky(uploadedImage, input.entry.number);
if (!spookyImage || typeof spookyImage !== "string") {
throw new Error("Failed to make image spooky");
}
@@ -79,6 +80,7 @@ export const entryRouter = createTRPCRouter({
type: z.enum(["artist", "album"]),
name: z.string().min(1),
image: z.string().min(1),
number: z.number().optional(),
}),
}),
)

View File

@@ -24,11 +24,16 @@ export const uploadImage = async (
}
};
export const makeImageSpooky = (publicId: string) => {
const options = {
effect:
"gen_background_replace:prompt_a bizarre and super creepy background acording with main object theme-max creativity",
};
export const makeImageSpooky = (publicId: string, number?: number) => {
const options: Record<string, string> = {};
if (number === 2) {
options.effect =
"gen_recolor:prompt_main_object_or_motive_on_image;to-color_green";
} else {
options.effect =
"gen_background_replace:prompt_a bizarre and super creepy background acording with main object theme-max creativity";
}
try {
const result = cloudinary.v2.image(publicId, { ...options });