mirror of
https://github.com/FranP-code/spooky-spotify-showcase.git
synced 2025-10-13 00:02:36 +00:00
Added second album image
This commit is contained in:
@@ -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(),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user