geekcom/image-to-uri 问题修复 & 功能扩展

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

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

geekcom/image-to-uri

Composer 安装命令:

composer require geekcom/image-to-uri

包简介

Batch convert images to data URIs

README 文档

README

A simple PHP class for batch convert images to data URI

What Is a Data URI?

A data URI is a base64 encoded string that represents a file. Getting the contents of a file as a string means that you can directly embed the data within your HTML or CSS code. When the browser encounters a data URI in your code, it’s able to decode the data and construct the original file.

Why Data URIs?

The main benefit to using data URIs is that you can reduce the number of HTTP requests that your site needs to make to load the page. Each individual file referenced in your CSS or HTML code will create a new HTTP request. By using data URIs, you’re actually embedding the file data directly within your HTML or CSS file, so there’s no need to make a HTTP request to fetch the resource.

Installation

Install Composer if you don't have it.

composer require geekcom/image-to-uri

Or in your file'composer.json' add:

{
    "require": {
        "geekcom/image_to_uri": "^1.0.0"
    }
}

And the just run:

composer install

and thats it.

How to use

  • Put all the images you want to convert into the folder /images
  • The file containing the URIs data will be written at folder /dataUris
  • imageToURI(array $images, string $outputFile, bool $overWrite = false)

Example

require __DIR__ . '/src/image2URI.php';

use imageToURI\imageToURI;

$images = new imageToURI();

$images->imageToURI(['images/image1.png', 'images/image2.png' ], 'dataUris/dataUris.txt', false);

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固