PHPackages                             xoixoi/imagify - 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. xoixoi/imagify

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

xoixoi/imagify
==============

Thư viện xử lý ảnh PHP mạnh mẽ với các tính năng: watermark, resize, tối ưu hóa và chuyển đổi WebP

03PHP

Since May 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xoidev39/imagify)[ Packagist](https://packagist.org/packages/xoixoi/imagify)[ RSS](/packages/xoixoi-imagify/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

📸 iMagify - Thư viện xử lý ảnh PHP mạnh mẽ
==========================================

[](#-imagify---thư-viện-xử-lý-ảnh-php-mạnh-mẽ)

**iMagify** là một thư viện PHP giúp xử lý ảnh hiệu quả cho các ứng dụng web hoặc hệ thống nội bộ. Thư viện hỗ trợ các chức năng như thêm watermark, resize ảnh, tối ưu hóa dung lượng và chuyển đổi định dạng sang WebP. Được thiết kế linh hoạt với khả năng sử dụng các công cụ nhị phân (qua `exec()`) hoặc fallback về GD nếu cần.

---

🚀 Tính năng nổi bật
-------------------

[](#-tính-năng-nổi-bật)

- ✅ **Thêm watermark**: hỗ trợ nhiều vị trí, độ mờ, tỉ lệ, khoảng cách.
- 🖼️ **Resize ảnh**: cho nhiều kích thước tùy biến.
- 📦 **Tối ưu hóa ảnh**: giảm dung lượng ảnh bằng các công cụ như `jpegtran`, `optipng`, `pngquant`, `gifsicle`.
- 🌐 **Chuyển đổi sang WebP**: sử dụng `cwebp` hoặc GD WebP.
- 🔄 **Xử lý hàng loạt**: với `BatchProcessor`.
- 🧠 **Tự động fallback**: sử dụng thư viện GD khi môi trường không hỗ trợ `exec()`.
- 🔧 **Tùy biến linh hoạt**: qua các tùy chọn cấu hình đa dạng.

---

📦 Cài đặt
---------

[](#-cài-đặt)

```
composer require xoixoi/imagify
```

---

🔧 Yêu cầu hệ thống
------------------

[](#-yêu-cầu-hệ-thống)

- PHP &gt;= 7.4
- GD Library (nếu không sử dụng exec)
- Hệ điều hành hỗ trợ thực thi `exec()` (Linux, macOS, Windows)

---

🛠️ Hướng dẫn sử dụng
--------------------

[](#️-hướng-dẫn-sử-dụng)

### ✅ Xử lý một ảnh

[](#-xử-lý-một-ảnh)

```
use Xoixoi\IMagify\ImageProcessor;

$processor = new ImageProcessor([
    'enable_watermark' => true,
    'watermark_image' => '/path/to/watermark.png',
    'watermark_position' => 'bottom-right',
    'watermark_opacity' => 80,
    'enable_webp' => true,
    'webp_quality' => 80
]);

$result = $processor->process(
    '/path/to/source.jpg',
    '/path/to/destination.jpg',
    [
        ['name' => 'thumbnail', 'width' => 150, 'height' => 150],
        ['name' => 'medium', 'width' => 300, 'height' => 300]
    ]
);
```

### 🔁 Xử lý nhiều ảnh

[](#-xử-lý-nhiều-ảnh)

```
use Xoixoi\IMagify\BatchProcessor;

$batch = new BatchProcessor($processor);

// Xử lý danh sách ảnh
$results = $batch->process([
    '/path/to/image1.jpg',
    '/path/to/image2.png'
], '/path/to/output');

// Hoặc toàn bộ thư mục
$results = $batch->processDirectory(
    '/path/to/source/dir',
    '/path/to/output/dir',
    [['name' => 'thumbnail', 'width' => 150, 'height' => 150]]
);
```

---

⚙️ Danh sách tùy chọn `ImageProcessor`
--------------------------------------

[](#️-danh-sách-tùy-chọn-imageprocessor)

Tùy chọnMô tảMặc địnhenable\_watermarkBật/tắt tính năng watermark`false`enable\_optimizeBật/tắt tối ưu hóa dung lượng ảnh`true`enable\_webpBật/tắt chuyển đổi sang WebP`true`watermark\_imageĐường dẫn đến ảnh watermark`''`watermark\_positionVị trí watermark: `top-left`, `top-right`, `bottom-left`,...`bottom-right`watermark\_opacityĐộ trong suốt của watermark (0-100)`80`watermark\_scaleTỷ lệ kích thước watermark (%)`20`watermark\_marginKhoảng cách watermark so với viền`10`watermark\_margin\_unitĐơn vị khoảng cách: `px`, `%``px`webp\_qualityChất lượng ảnh WebP (0-100)`80`exclude\_keywordsCác từ khóa loại trừ (dùng khi batch xử lý)`''`sizes\_to\_convertDanh sách kích thước cần xử lý`['FULL']`sizes\_to\_watermarkDanh sách kích thước cần watermark`['FULL']`---

🗂 Cấu trúc thư mục dự án
------------------------

[](#-cấu-trúc-thư-mục-dự-án)

```
iMagify/
├── composer.json                  # Cấu hình autoload & dependency Composer
├── README.md                      # Tài liệu sử dụng
├── src/
│   ├── ImageProcessor.php         # Xử lý chính: resize, watermark, convert, optimize
│   ├── ImageProcessorOptions.php  # Quản lý các tùy chọn cấu hình xử lý ảnh
│   ├── bin/                       # Thư mục chứa binary tương ứng theo hệ điều hành
│   │   └── cwebp-*, jpegtran-*, gifsicle-*, optipng-*, pngquant-*  (Windows, Linux, macOS)
│   ├── Driver/
│   │   ├── BinaryDriver.php       # Gọi binary thực thi bằng `exec()`
│   │   ├── DriverInterface.php    # Interface chuẩn cho các driver ảnh
│   │   └── GDDriver.php           # Driver fallback dùng thư viện GD
│   ├── Exception/
│   │   └── ImageProcessorException.php  # Xử lý lỗi tùy biến
│   ├── lib/
│   │   ├── iMagify.php            # Wrapper thư viện chính
│   │   ├── wwc-image-converter.php  # Chuyển đổi định dạng nội bộ
│   │   └── wwc-watermark.php      # Thêm watermark vào ảnh
│   ├── Watermark/
│   │   ├── Watermark.php          # Lớp xử lý watermark
│   │   └── WatermarkInterface.php # Interface cho watermark engine

```

---

📄 Giấy phép
-----------

[](#-giấy-phép)

**MIT License** — Tự do sử dụng, sửa đổi, phân phối.

---

🤝 Đóng góp
----------

[](#-đóng-góp)

Thư viện hiện đang phát triển nội bộ, nếu bạn quan tâm đến việc đóng góp hoặc sử dụng phiên bản public, vui lòng theo dõi bản phát hành tiếp theo hoặc liên hệ trực tiếp.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

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/03169fedefde8ab296f89db45b8c6ee42139c94e005401336ebd51df882df22a?d=identicon)[xoidev](/maintainers/xoidev)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/xoixoi-imagify/health.svg)

```
[![Health](https://phpackages.com/badges/xoixoi-imagify/health.svg)](https://phpackages.com/packages/xoixoi-imagify)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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