pomirleanu/gif-create 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pomirleanu/gif-create

Composer 安装命令:

composer require pomirleanu/gif-create

包简介

Easy way to create gif animations from png images.

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Easy way to create gif animations from png images for laravel 5.*.

Install

Via Composer

$ composer require pomirleanu/gif-create

Usage basic php

1. Inputs:

// Use an array containing file paths, resource vars (initialized with imagecreatefromXXX), 
// image URLs or binary image data.
$frames = array(
    imagecreatefrompng("/../images/pic1.png"),      // resource var
    "/../images/pic2.png",                          // image file path
    file_get_contents("/../images/pic3.jpg"),       // image binary data
    "http://thisisafakedomain.com/images/pic4.jpg", // URL
);

// Or: load images from a dir (sorted, skipping .files):
//$frames = "../images";

// Optionally: set different durations (in 1/100s units) for each frame
$durations = array(20, 30, 10, 10);

// Or: you can leave off repeated values from the end:
//$durations = array(20, 30, 10); // use 10 for the rest
// Or: use 'null' anywhere to re-apply the previous delay:
//$durations = array(250, null, null, 500);

2. Create the GIF:

use Pomirleanu\GifCreate;

// ...

$gif = new GifCreate\GifCreate();
$gif->create($frames, $durations);

// Or: using the default 100ms even delay:
//$gif->create($frames);

// Or: loop 5 times, then stop:
//$gif->create($frames, $durations, 5); // default: infinite looping

3. Get/use the result:

You can now get the animated GIF binary:

$gif = $gif->get();

...and e.g. send it directly to the browser:

header("Content-type: image/gif");
echo $gif;
exit;

Or just save it to a file:

$gif->save("animated.gif");

Usage in laravel 5.*

Service provider should be :

Pomirleanu\GifCreate\GifCreateServiceProvider::class,

Publish needed assets (config file) :

php artisan vendor:publish --provider="Pomirleanu\GifCreate\GifCreateServiceProvider"

Note: Composer won't update them after composer update, you'll need to do it manually!

Behavior

  • Transparency is based on the first frame. [!!NOT VERIFIED: "It will be saved only if you give multiple frames with the same transparent background"]
  • The dimensions of the generated GIF are based on the first frame, too. If you need to resize your images to get the same dimensions, you can use this class: https://github.com/Sybio/ImageWorkshop.

Dependencies

  • PHP 5.3 (for namespace support & whatnot; noone still shamelessly uses PHP < 5.3, right?!)
  • GD (imagecreatefromstring, imagegif, imagecolortransparent)

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email pomirleanu.florentin@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

pomirleanu/gif-create 适用场景与选型建议

pomirleanu/gif-create 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.33k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2016 年 09 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pomirleanu」 「GifCreate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pomirleanu/gif-create 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pomirleanu/gif-create 我们能提供哪些服务?
定制开发 / 二次开发

基于 pomirleanu/gif-create 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-26