milanspv/php-inline-images
Composer 安装命令:
composer require milanspv/php-inline-images
包简介
A lib to handle image inlining in your (css, img src, etc.)
README 文档
README
A PHP lib to handle image inlining in your (css, img src, etc.)
Install
composer require milanspv/php-inline-images
Convert an image to an inline string value
<?php // first way to initialize the object $inliner = new InlineImages\Converter(); $inliner->setPath('/path/to/img.png'); // second way to initialize the object $inliner = new InlineImages\Converter('/path/to/img.png'); // convert image echo '<img src="'.$inliner->convert().'"/>'; //or for css echo 'background: url('.$inliner->convert().')';
Convert a remote image to inline string value
<?php $inliner = new InlineImages\Converter('http://path/to/img.png'); echo '<img src="'.$inliner->convert().'"/>'; //or for css echo 'background: url('.$inliner->convert().')';
Inline SVGs
<?php $inliner = new InlineImages\Converter('/path/to/img.svg'); echo '<img src="'.$inliner->convert().'"/>'; //or for css echo 'background: url('.$inliner->convert().')';
统计信息
- 总下载量: 1.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-12-16