定制 metastrip/image 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

metastrip/image

Composer 安装命令:

composer require metastrip/image

包简介

A lightweight PHP library for efficiently removing EXIF, IPTC, and other metadata from images while preserving quality. Supports JPEG, PNG, and GIF formats.

README 文档

README

CI codecov Latest Stable Version License PHP Version Require

A lightweight PHP library for efficiently removing EXIF, IPTC, and other metadata from images while preserving quality. Supports JPEG, PNG, and GIF formats.

Features

  • Efficient metadata removal with zero quality loss
  • Supports multiple image formats and metadata types:
    • JPEG: EXIF and IPTC markers
    • PNG: tEXt, iTXt, and zTXt chunks
    • GIF: XMP and Application Extension blocks
  • Privacy-focused: removes sensitive information
  • Zero external dependencies (PHP GD only)
  • Clean, object-oriented architecture
  • Comprehensive test coverage
  • PSR-12 compliant

Requirements

  • PHP 8.0 or higher
  • GD extension

Installation

Install via Composer:

composer require metastrip/image

Usage

Basic usage:

use MetaStrip\Image\ImageProcessorFactory;

// Create processor instance
$processor = ImageProcessorFactory::create();

// Strip metadata from an image
$processor->stripExifData('/path/to/image.jpg');

Advanced usage with specific handlers:

use MetaStrip\Image\ImageProcessor;
use MetaStrip\Image\ImageHandler\JpegHandler;
use MetaStrip\Image\ImageHandler\PngHandler;
use MetaStrip\Image\ImageHandler\GifHandler;

// Create processor with specific handlers
$processor = new ImageProcessor([
    IMAGETYPE_JPEG => new JpegHandler(),
    IMAGETYPE_PNG => new PngHandler(),
    IMAGETYPE_GIF => new GifHandler(),
]);

// Process multiple images
$processor->stripExifData('/path/to/image1.jpg');
$processor->stripExifData('/path/to/image2.png');
$processor->stripExifData('/path/to/image3.gif');

Development

Setup

  1. Clone the repository:
git clone https://github.com/metastrip/image.git
cd image
  1. Install dependencies:
composer install

Quality Tools

We use three main tools to ensure code quality:

  1. PHPUnit - Testing Framework

    # Run tests
    composer test
    
    # Generate coverage report
    composer test:coverage
  2. PHP_CodeSniffer - Code Style

    # Check coding standards
    composer cs
    
    # Fix coding standards automatically
    composer cs:fix
  3. PHPStan - Static Analysis

    # Run static analysis
    composer stan

Run all checks at once:

composer check

Continuous Integration

Our GitHub Actions workflow automatically runs:

  • Tests on PHP 8.0, 8.1, and 8.2
  • Code style checks
  • Static analysis
  • Code coverage reporting

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. By participating in this project, you agree to abide by its terms.

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Run the tests: composer check
  5. Commit your changes: git commit -m 'Add feature'
  6. Push to the branch: git push origin feature-name
  7. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-21