jyggen/youtubethumb
最新稳定版本:v2.1
Composer 安装命令:
composer require jyggen/youtubethumb
包简介
A PHP class created to help you load, edit and save thumbnails from videos on Youtube.
关键字:
README 文档
README
A PHP class created to help you load, edit and save thumbnails from videos on Youtube.
Find YoutubeThumb on Packagist/Composer
Examples
use jyggen\Youtube\Thumbnail; // Load a thumbnail and save it to disk. Thumbnail::forge('83fJ7hlZkpA')->save('my_path/'); // Maybe we wanna do some changes aswell. Retrieve the previously forged instance. $thumb = Thumbnail::instance('83fJ7hlZkpA'); // Get the Thumbnail's GD resource. $data = $thumb->getData(); // Create a new GD resource and copy a portion of the thumbnail into our new image. $dest = imagecreatetruecolor(80, 40); imagecopy($dest, $data, 0, 0, 20, 13, 80, 40); // Set our old thumbnail to the new resized one. $thumb->setData($dest); // Oh shit, did we fudge up something? Reset the image to its original state. $thumb->reset(); // We want to save the image again, but with a different name and extension. $thumb->setName('my_awesome_thumbnail'); $thumb->save('my_path/', 'gif');
Thumbnail object
Static Methods
- forge(string $youtubeId)
Forge a new Thumbnail instance. - instance(string $youtubeId)
Retrieve an existing Thumbnail instance.
Methods
- reset()
Reset the thumbnail to its original state. - save(string $path, string $extension = 'png')
Save the thumbnail to disk. - getData()
Get the thumbnail's GD resource. - setData(resource $data)
Set the thumbnail's GD resource. - getName()
Get the output name without extension. - setName(string $name)
Set the output name without extension.
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-24