Fix Display images by folder in cloudinary with gitauto model #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original issue: #1
What is the feature
This feature involves integrating Cloudinary with our Next.js application to manage images and folders. The admin page will allow users to list folders and their respective images, create new folders, and upload photos to selected folders.
Why we need the feature
Managing images and folders directly from the admin page will streamline the workflow for administrators, making it easier to organize and maintain the media assets. This will enhance the user experience by providing a centralized location for all media management tasks.
How to implement and why
Create Next.js API Routes:
pages/api/photos/get-cloudinary-photos.ts
to fetch and return the list of folders and their respective images from Cloudinary.pages/api/photos/create-folder.ts
to handle the creation of new folders in Cloudinary.pages/api/photos/upload-photo.ts
to handle photo uploads to a selected folder in Cloudinary.Update Admin Page UI:
pages/admin.tsx
to call theget-cloudinary-photos
API route and display the folders and images in a structured format.pages/admin.tsx
to allow users to input a new folder name and call thecreate-folder
API route.pages/admin.tsx
to allow users to select a photo and a dropdown to select the target folder, then call theupload-photo
API route.Cloudinary Integration:
Error Handling and Notifications:
components/Toast/createErrorToast.tsx
andcomponents/Toast/createSuccessToast.tsx
) to provide feedback to the user on the success or failure of their actions.By following these steps, we ensure a seamless integration with Cloudinary, providing a robust and user-friendly interface for managing media assets.
Test these changes locally