Hi, everyone!
I've created a useful package for Laravel developers. This package will help you to save your images secretly and show them to ones who you choose.
You can access this package by this link:
mohsenbostan / laravel-secret-image
A package to save images secretly.
Laravel Secret Image
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
…I'd be so happy if you contribute to the package to make it better.
Top comments (0)