PHPackages                             viraladmin/encrypted\_images\_php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. viraladmin/encrypted\_images\_php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

viraladmin/encrypted\_images\_php
=================================

Encrypted Images PHP is a PHP library designed for encrypting text into images and decrypting images back into text.

11PHP

Since Oct 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/viraladmin/encrypted_images_php)[ Packagist](https://packagist.org/packages/viraladmin/encrypted_images_php)[ RSS](/packages/viraladmin-encrypted-images-php/feed)WikiDiscussions main Synced 1mo ago

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

Encrypted Images PHP
====================

[](#encrypted-images-php)

**Author**: Bruce Bates
**Copyright**: 2023
**X**: @thebrucebates
**Website**:

License
-------

[](#license)

Encrypted Images PHP is distributed under the MIT License. [![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

Installation
------------

[](#installation)

```
composer require viraladmin/encrypted_images_php

```

Table of Contents
-----------------

[](#table-of-contents)

1. [Introduction](#introduction)
2. [Supported Characters](#supported-characters)
3. [Min and Max Characters](#min-and-max-characters)
4. [Security](#security)
5. [Watermarks](#watermarks)
6. [Functions](#functions)
    - [Text Encryption](#text-encryption)
    - [Image Encryption](#image-encryption)
    - [Text Decryption](#text-decryption)
    - [Image Decryption](#image-decryption)

Introduction
------------

[](#introduction)

Encrypted Images PHP is a PHP library designed for encrypting text into images and decrypting images back into text.

Supported Characters
--------------------

[](#supported-characters)

The library supports the following characters:

- Lowercase letters (a-z)
- Uppercase letters (A-Z)
- Equal sign (=)
- Backslash ()
- Plus sign (+)

Please note that space (" ") is not included in the supported characters.

Min and Max Characters
----------------------

[](#min-and-max-characters)

- **Minimum Characters**: 10
- **Maximum Characters**: 5,006,512 (memory exhaustion)
    - Please note that memory exhaustion may occur much earlier when converting encrypted text to images.

Security
--------

[](#security)

This library is secure (as much as php can be) against encryption timing attacks.

Watermarks
----------

[](#watermarks)

Encrypted Images PHP supports various watermarks that you can embed into the images. You can choose from the following watermark types:

- Ethereum
- Bitcoin
- Cardano
- None

Functions
---------

[](#functions)

### Text Encryption

[](#text-encryption)

Encrypt a string using AES-128-CBC encryption and verify integrity to protect against timing attacks.

**Parameters:**

- `$str` (string): The input string to be encrypted.
- `$key` (string, optional): The encryption key. Default is "welovenfts".

**Returns:**

- (string|false): The encrypted string or false if encryption fails or integrity check fails.

**Example Usage:**

```
require_once 'vendor/autoload.php';
use encrypted_images_php\encryption\text;

// Initialize the class
$textEncryptor = new text();

// Encrypt a string
$encryptedString = $textEncryptor->encrypt("Your secret message", 'encryption-key');

// Check if encryption was successful
if ($encryptedString !== false) {
    // Proceed with the encrypted data
} else {
    // Handle the encryption failure
}
```

### Image Encryption

[](#image-encryption)

Encrypt a string and embed it into an image with a watermark.

**Parameters:**

- `$str` (string): The input string to be encrypted.
- `$watermark` (string, optional): The watermark type (e.g., 'ethereum', 'bitcoin', 'cardano').
- `$key` (string, optional): The encryption key. Default is "welovenfts".
- `$r` (int, optional): Top gradient adjustment.
- `$g` (int, optional): Middle gradient adjustment.
- `$b` (int, optional): Bottom gradient adjustment.

**Returns:**

- (string): Base64-encoded image containing the encrypted data.

**Example Usage:**

```
require_once 'vendor/autoload.php';
use encrypted_images_php\encryption\images;

// Initialize the class
$imageEncryptor = new images();

// Encrypt a string and embed it into an image with a watermark
$imageData = $imageEncryptor->encryptToImage("Your secret message", 'ethereum', 'encryption-key', 100, 134, 131);

// Display or use the base64-encoded image data as needed
echo '';
```

### Text Decryption

[](#text-decryption)

Decrypt an encrypted text and return the original plaintext.

**Parameters:**

- `$text` (string): The encrypted text to be decrypted.
- `$key` (string, optional): The decryption key. Default is "welovenfts".

**Returns:**

- (string|array): Original plaintext or an error message.

**Example Usage:**

```
require_once 'vendor/autoload.php';
use encrypted_images_php\decryption\text;

// Initialize the class
$textDecryptor = new text();

// Decrypt an encrypted text
$decryptedText = $textDecryptor->decrypt($encryptedText, 'decryption-key');

if ($decryptedText !== 'error') {
    // Proceed with the original plaintext
} else {
    // Handle the decryption error
}
```

### Image Decryption

[](#image-decryption)

Decrypt data from an image and return the original plaintext.

**Parameters:**

- `$fileData` (string): The image data or file path.
- `$key` (string, optional): The decryption key. Default is "welovenfts".
- `$datatype` (string, optional): The data type, either "web" or "json".

**Returns:**

- (string|array): An error message if decryption fails or the original plaintext.

**Example Usage:**

```
require_once 'vendor/autoload.php';
use encrypted_images_php\decryption\images;

// Initialize the class
$imageDecryptor = new images();

// Decrypt data from an image
$decryptedText = $imageDecryptor->decryptFromImage($imageData, 'decryption-key', 'web');

if (!is_string($decryptedText)) {
    // Proceed with the original plaintext
} else {
    // Handle the decryption error
}
```

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c531c54730633e4dabd7a39e9860d43e547b07d320f4e314a673c4ae1a533f06?d=identicon)[viraladmin](/maintainers/viraladmin)

---

Top Contributors

[![viraladmin](https://avatars.githubusercontent.com/u/22060035?v=4)](https://github.com/viraladmin "viraladmin (6 commits)")

### Embed Badge

![Health badge](/badges/viraladmin-encrypted-images-php/health.svg)

```
[![Health](https://phpackages.com/badges/viraladmin-encrypted-images-php/health.svg)](https://phpackages.com/packages/viraladmin-encrypted-images-php)
```

PHPackages © 2026

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