1 Star 0 Fork 2

八戒/php图片生成gif

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
git.php 830 Bytes
一键复制 编辑 原始数据 按行查看 历史
八戒 提交于 2018-09-01 20:56 +08:00 . no commit message
<?php
include 'Gifcreator.php';
$img_dir = date('dHis').'-'.rand(1000,9999);
if (!file_exists($img_dir)){
mkdir($img_dir, 0777, true);
}
$picArr = [];
$files = $_POST['files'];
if(!empty($files)) {
foreach ($files as $k => $v) {
$img_path = $img_dir.'/'.$k.'.jpg';
$base_img= explode(',', $v);
file_put_contents($img_path, base64_decode($base_img[1]));
$picArr[] = $img_path;
}
}
$num = count($picArr);
for($i=0;$i<$num;$i++) {
$durations[] = 15; //控制每帧图片切换速度越大越慢
}
$gitCreator = new gifcreator();
$gitCreator->create($picArr, $durations, 0);
$gifBinary = $gitCreator->getGif();
$code = rand(10000,99999);
$gif_path = $img_dir.'/'.$code.'.gif';
file_put_contents($gif_path, $gifBinary);
$data = ['code'=>200, 'url'=>$gif_path];
exit(json_encode($data));
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/yuanyuange/php_image_generation_gif.git
[email protected]:yuanyuange/php_image_generation_gif.git
yuanyuange
php_image_generation_gif
php图片生成gif
master

搜索帮助