mohsenbostan / laravel-secret-image
A package to save images secretly.
Requires
- php: ^7.3
- illuminate/support: ^6.0 || ^7.0 || ^8.0
- intervention/image: ^2.5
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
This package helps you to save your images secretly and show them just to authenticated users.
Installation
You can install the package via composer:
composer require mohsenbostan/laravel-secret-image
after installing package using composer, you should publish configs:
php artisan vendor:publish --provider=Mohsenbostan\LaravelSecretImage\LaravelSecretImageServiceProvider
Usage
Custom Storage Driver
you can set a custom storage driver in config/laravel-secret-image.php
<?php return [ /* * Default Storage Driver To Save Images * ------------------------------------- * Note: Don't use `public` for driver or path. */ 'storage_driver' => env('FILESYSTEM_DRIVER', 'local'), ];
Custom Middlewares
you can set custom middlewares to protect images in config/laravel-secret-image.php
<?php return [ /* * Default Middlewares To Protect Images */ 'middlewares' => [ 'auth' ] ];
Save Single Secret Image
saveSingleImage
method will save image and return the image path.
use \Mohsenbostan\LaravelSecretImage\LaravelSecretImage; $image = LaravelSecretImage::saveSingleImage(request()->file('image'));
Save Multiple Secret Images
saveMultiImages
method will save all images and return the images' path.
use \Mohsenbostan\LaravelSecretImage\LaravelSecretImage; $images = LaravelSecretImage::saveMultiImages(request()->file('images'));
Get Secret Image Url
getImageUrl
method will return image url.
use \Mohsenbostan\LaravelSecretImage\LaravelSecretImage; $url = LaravelSecretImage::getImageUrl($image);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email mohsenbostandev@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.