Fix Display images by folder in cloudinary with gitauto model #2
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
The feature involves integrating Cloudinary with a Next.js application to manage images and folders. Specifically, it includes creating API endpoints and UI components for listing folders and their images, creating new folders, and uploading photos to selected folders from an admin page.
Why we need the feature
This feature is essential for efficiently managing a large number of images and organizing them into folders, making it easier for users to navigate and manage their content. It enhances the admin's ability to control and update the website's visual content directly from the admin page without needing to manually handle files or interact with the Cloudinary dashboard.
How to implement and why
Create a Next.js API route for listing folders and images:
pages/api/photos/get-cloudinary-photos.ts
Update the admin page to display folders and images:
pages/admin.tsx
Create a Next.js API route for creating a new folder:
pages/api/photos/create-folder.ts
Add functionality to upload photos to a selected folder:
pages/api/photos/upload-photo.ts
pages/admin.tsx
) to include a file upload input and a folder selection dropdown. When a user selects a file and a folder and submits the form, it will call this API route to perform the upload.Implementing these features will significantly enhance the admin's ability to manage images and folders, making the website more dynamic and easier to update. It leverages Cloudinary's powerful media management capabilities while providing a simple and intuitive interface for the admin.
Test these changes locally