Add functionality to delete images from the gallery and Cloudinary
Implement image deletion functionality, including a confirmation dialog and API endpoint for removing images from Cloudinary and updating the gallery map. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 23852c00-4779-460a-9e0c-d09fee4b6c92 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 37efc56d-aeff-47ff-8064-9aa64d8b204c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/23852c00-4779-460a-9e0c-d09fee4b6c92/ncMMRQ9 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -92,6 +92,16 @@ export async function uploadToCloudinary(imageUrl: string, fileName: string): Pr
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteFromCloudinary(publicId: string): Promise<boolean> {
|
||||
try {
|
||||
const result = await cloudinary.uploader.destroy(publicId, { resource_type: "image" });
|
||||
return result.result === "ok";
|
||||
} catch (err: any) {
|
||||
console.error(`Cloudinary delete failed for ${publicId}:`, err.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkCloudinaryImage(publicId: string): Promise<boolean> {
|
||||
try {
|
||||
await cloudinary.api.resource(publicId);
|
||||
|
||||
Reference in New Issue
Block a user