melihovv/base64-image-decoder
Composer 安装命令:
composer require melihovv/base64-image-decoder
包简介
A base64 image decoder
README 文档
README
A small set of classes (decoder, encoder) to work with images as data-uris.
Installation
Install via composer
composer require melihovv/base64-image-decoder
Usage
Encoder
use Melihovv\Base64ImageDecoder\Base64ImageEncoder; $encoder = Base64ImageEncoder::fromFileName('/path/to/picture.jpg', $allowedFormats = ['jpeg', 'png', 'gif']); #$encoder = Base64ImageEncoder::fromBinaryData($someRawBinaryData, $allowedFormats = ['jpeg', 'png', 'gif']); #$encoder = Base64ImageEncoder::fromResource($someResource, $allowedFormats = ['jpeg', 'png', 'gif']); $encoder->getMimeType(); // image/jpeg for instance $encoder->getContent(); // base64 encoded image bytes. $encoder->getDataUri(); // a base64 data-uri to use in HTML or CSS attributes.
Decoder
use Melihovv\Base64ImageDecoder\Base64ImageDecoder; $dataUri = 'data:image/gif;base64,R0lGODlhLAH6AOZ/AMyokXJMK0uE...'; // image may come from http request or any other source. // We check that image is encoded properly in constructor, otherwise exception will be thrown. // You can use this info in your validation rule. $decoder = new Base64ImageDecoder($dataUri, $allowedFormats = ['jpeg', 'png', 'gif']); $decoder->getFormat(); // 'png', or 'jpeg', or 'gif', or etc. $decoder->getDecodedContent(); // base64 decoded raw image bytes. $decoder->getContent(); // base64 encoded raw image bytes.
Security
If you discover any security related issues, please email amelihovv@ya.ru instead of using the issue tracker.
Credits
This package is bootstrapped with melihovv/laravel-package-generator.
melihovv/base64-image-decoder 适用场景与选型建议
melihovv/base64-image-decoder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 143.86k 次下载、GitHub Stars 达 46, 最近一次更新时间为 2018 年 02 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「base64」 「decoder」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 melihovv/base64-image-decoder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 melihovv/base64-image-decoder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 melihovv/base64-image-decoder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
AMWSCAN (Antimalware Scanner) is a php antimalware/antivirus scanner console script written in php for scan your project. This can work on php projects and a lot of others platform.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Streaming parser to extract tarballs with ReactPHP.
base62 encoder and decoder also for big numbers with Laravel integration
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
base64 image verification captcha library for webman plugin
统计信息
- 总下载量: 143.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-11