heddiyoussouf/mediasignature
Composer 安装命令:
composer require heddiyoussouf/mediasignature
包简介
Mediasignature is a powerful and versatile package designed to provide image tokenization and access control capabilities. With Mediasignature, you can securely tokenize images and limit access to them for a specified period, adding an extra layer of protection to your valuable visual content
README 文档
README
Mediasignature is a powerful package that provides secure tokenization and time-limited access control for images. It allows you to protect your images by generating unique tokens and controlling access to them within specified time limits.
Features
- Image Tokenization: Generate unique and tamper-proof tokens for each image to ensure secure access.
- Time-Limited Access: Set expiration dates and times for image access, providing granular control over accessibility.
- Robust Security Measures: Utilize strong encryption algorithms to safeguard images and tokens from unauthorized access.
- Flexible Integration: Seamlessly integrate with existing image storage and retrieval systems.
- User-Friendly Interface: Easy-to-use interface for token generation, access management, and monitoring.
- Compliance and Privacy: Prioritize compliance with privacy laws and regulations to protect user data and sensitive images.
Installation
To install Mediasignature, follow these steps:
- Clone the repository:
composer require heddiyoussouf/mediasignature. - Publish MediasigntureProvider:
php artisan vendor:publish --provider=Heddiyoussouf\Mediasignature\MediasignatureProvider. - Check the
mediasignaturefile inside the config folder.
Getting Started
To start using Mediasignature, you need to perform the following steps:
- Import the Mediasignature facade into your project:
Heddiyoussouf\Mediasignature\Facades\Mediasignature. - Generate an url for an image
Mediasignature::wrap()for single media file andMediasignature::wrapForMultiple()for multiple file.
Documentation
Refer to the documentation for detailed usage instructions and code samples.
In a Laravel application, there are two common methods for uploading media files:
Moving File Directly to the Public Folder:
$request->image->move(public_path('/images'), 'name.jpg');
MedfiaFile::create(["path" => "images/name.jpg"]);
This approach involves moving the file directly to the public folder of your application using the $request->image->move() method. After moving the file, you can create a new record in the MediaFile model (assuming such a model exists) and store the file path.
Using the Filesystem:
$path = $request->file('image')->store('images');
// or
$path = Storage::disk('public')->putFile('images', $image);
MedfiaFile::create(["path" => $path]);
Laravel provides a filesystem API for file storage, which offers convenience and flexibility. You can use the $request->file()->store() method or the Storage::disk()->putFile() method to upload the file to the desired directory. After storing the file, you can create a new record in the MediaFile model and store the returned file path.
Please note that you should adjust the file paths and model names to match your specific application structure. Also, ensure that you handle any necessary validations or security measures when implementing file uploads in your Laravel application.
In Mediasignature, there are two common methods for wrapping media files. Here's a more formal description of each method:
Using Default Configuration:
$file = MediaFile::find($id);
return Mediasignature::wrap($file->path);
This approach utilizes the default configuration specified in the config/mediasignature.php file. The wrap() method is called with the file path as the parameter, and it returns a wrapped version of the file path (url).
Using Custom Configuration:
$file = MediaFile::find($id);
return Mediasignature::wrap($file->path, $ttl, $filesystem, $disk);
In this method, you can specify custom configuration options for wrapping the file: $ttl (integer/nullable): Sets the time-to-live in minutes, indicating the duration for which the wrapped file will be accessible. $filesystem (boolean/nullable): Set to false if you used the first method to upload media directly, and true if you used the filesystem. $disk (enum [local or public]/nullable): Specify the disk to be used if you used the filesystem option.
This method allows you to override the default configuration for a specific file. By providing custom values for $ttl, $filesystem, and $disk, you can control the wrapping behavior according to your requirements.
Additionally, you can use the Mediasignature::wrapForMultiple() method to wrap multiple files at once:
Mediasignature::wrapForMultiple($array_path)
Mediasignature::wrapForMultiple($array_path, $ttl, $filesystem, $disk)
These methods accept an array of file paths ($array_path) as the first parameter and provide options for customizing the wrapping process similar to the individual file wrapping method.
Please ensure that you provide appropriate values for the parameters and follow the documentation for proper usage of the Mediasignature package.
Contributing
We welcome contributions to Mediasignature! If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature - Make your changes and commit them:
git commit -am 'Add your feature' - Push to the branch:
git push origin feature/your-feature - Submit a pull request.
Please ensure that your code follows the project's coding conventions and includes appropriate tests.
heddiyoussouf/mediasignature 适用场景与选型建议
heddiyoussouf/mediasignature 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 heddiyoussouf/mediasignature 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 heddiyoussouf/mediasignature 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-06-18