Introduction
Backend controller for managing image repository functionalities
Overview
The Repository
class extends the Backend
class and provides functionality for managing an image repository, including categories, tags, and image items. It includes methods for saving, customizing, and uploading images, as well as managing related metadata.
Constructor
Initializes the Repository class, loads the Content_model, and checks for admin privileges.
If the user is not an admin, they will be redirected to the home page.
Methods
saveOneImage
Updates the metadata for a single image in the repository.
Returns a JSON response with the updated image data.
categories
Displays and manages image categories using a CRUD interface.
tags
Displays and manages image tags using a CRUD interface.
items
Displays and manages repository items (images) using a CRUD interface. This method sets up various fields for image metadata and relationships.
customizeImage
Customizes an image’s metadata and relationships based on POST data.
saveImage
Saves a new image to the repository with associated metadata.
Returns a JSON response with the newly created image data.
upload_image
Handles the upload of an image file, creates thumbnails, and returns metadata.
Returns a JSON response with the upload results, including file paths and image dimensions.
crop_image
Crops an existing image based on provided coordinates and saves it as a new image in the repository.
Returns a JSON response with the cropped image data, including file paths.