Download the PHP package stew/image-uploader without Composer
On this page you can find all versions of the php package stew/image-uploader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stew/image-uploader
More information about stew/image-uploader
Files in stew/image-uploader
Package image-uploader
Short Description Image uploads using Laravel Storage and conversion to format .webp
License MIT
Informations about the package image-uploader
Usage Instructions for Image Uploader
Installation
Usage
-
Step 1: Import the UploaderTrait
- Step 2: Implement the Trait in Your Class/Controller
Utilize the Provided Methods
Get Image Disk
-
The getImageDisk() method retrieves the name of the image storage disk. By default, it reads the FILESYSTEM_DISK environment variable. You can specify a different disk by setting the FILESYSTEM_DISK variable in your environment configuration.
-
Make sure that your
.env
file and configfilesystems.default
has the FILESYSTEM_DISK variable, for example: -
To use the database for storing configuration, you need to run a migration with the following command:
-
The above command will create a "settings" table with the following structure:
-
We have provided sample data for you to test. You can seed the sample data with the following command.
-
To use configuration from the "settings" table (by default), you can use the following function:
- If you want to customize the seeded data, you can use the following command:
Get Storage Directory
- To obtain the storage directory for images, use the getDirectory($path) method.
Save Image File to Storage
- This method is used to save an image file to your storage. It returns a string representing the path to the saved image with a .webp extension.
Check for Base64 String
- To check if a string is a base64 string, use the isBase64($strEndcode) method.
Delete Image
- To delete an image file from storage, utilize the deleteImage($filePath) method.
The Public Disk
- To create the symbolic link, you may use the storage:link Artisan command: