PHPackages                             geekcom/image-to-uri - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. geekcom/image-to-uri

ActiveLibrary[Image &amp; Media](/categories/media)

geekcom/image-to-uri
====================

Batch convert images to data URIs

v1.0.0(8y ago)015MITPHPPHP &gt;=7.0

Since Mar 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/geekcom/image-to-uri)[ Packagist](https://packagist.org/packages/geekcom/image-to-uri)[ RSS](/packages/geekcom-image-to-uri/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

imageToUri
==========

[](#imagetouri)

*A simple PHP class for batch convert images to data URI*

What Is a 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?
--------------

[](#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
------------

[](#installation)

Install [Composer](http://getcomposer.org) 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

[](#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

[](#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](https://github.com/geekcom/image-to-uri/blob/master/LICENSE)
----------------------------------------------------------------------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2982d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c09ec071fc7c89679501f7e67372b96cb3421d682c26b0bf42162cf48e94b73?d=identicon)[geekcom](/maintainers/geekcom)

---

Top Contributors

[![geekcom](https://avatars.githubusercontent.com/u/3955933?v=4)](https://github.com/geekcom "geekcom (3 commits)")

---

Tags

imagebase64jpguri-generator

### Embed Badge

![Health badge](/badges/geekcom-image-to-uri/health.svg)

```
[![Health](https://phpackages.com/badges/geekcom-image-to-uri/health.svg)](https://phpackages.com/packages/geekcom-image-to-uri)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[spatie/image

Manipulate images with an expressive API

1.4k54.4M138](/packages/spatie-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[melihovv/base64-image-decoder

A base64 image decoder

46137.0k](/packages/melihovv-base64-image-decoder)[vajiral/php-image-compare

A light weight PHP class that can compare two (jpg/png) images to find if they are similar.

1797.9k1](/packages/vajiral-php-image-compare)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
