selective/image-type 问题修复 & 功能扩展

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

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

selective/image-type

最新稳定版本:1.2.0

Composer 安装命令:

composer require selective/image-type

包简介

Image type detection

README 文档

README

Image type detection library for PHP.

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Features

  • Detection of the image type based on its content (header)
  • No dependencies
  • Very fast

Supported formats

Raster

  • ANI (Animated Cursor)
  • BMP (Windows Bitmap)
  • CUR (Cursor)
  • DICOM (Digital Imaging and Communications in Medicine)
  • GIF (Graphics Interchange Format)
  • HEIF / HEIC (High Efficiency Image File Format) / Apple iPhone photos
  • ICO (Icon)
  • JNG (JPEG Network Graphics)
  • JPEG 2000
  • JPG / JPEG (Joint Photographic Experts Group)
  • JPM (JPEG 2000 compound image)
  • MNG (Multiple-image Network Graphics)
  • PDN (PaintDotNet)
  • PGM (Portable Graymap)
  • PNG (Portable Network Graphics)
  • PPM (Portable Pixelmap)
  • PSB (Photoshop Large Document)
  • PSD (Photoshop Document)
  • TIF / TIFF (Tagged Image File Format)
  • WEBP (WebP)
  • XCF (eXperimental Computing Facility (GIMP))

Vector

  • AI (Adobe Illustrator)
  • EMF (Enhanced Metafile)
  • EMF+ (Enhanced Metafile)
  • SVG (Scalable Vector Graphics)
  • WMF (Windows Metafile Format)

Compound

  • SWF (Small Web Format, Flash)

RAW

  • 3FR (Hasselblad)
  • CR2 (Cannon)
  • CR3 (Canon)
  • DNG (Digital Negative - Adobe)
  • IIQ (Phase One)
  • ORF (Olympus)
  • PEF (Pentax)
  • RW2 (Panasonic)

HDR

  • JPEG-HDR
  • CIN (Cineon Image File Format, Kodak)
  • DPX (Digital Picture Exchange)
  • OpenEXR
  • PBM (Portable Bit Map HDR)
  • PFM (Portable Float Map)
  • Radiance HDR

Requirements

  • PHP 8.1+

Installation

composer require selective/image-type 

Usage

Detect the image type of file

use Selective\ImageType\ImageTypeDetector; use Selective\ImageType\Provider\RasterProvider; use Selective\ImageType\Provider\HdrProvider; use Selective\ImageType\Provider\RawProvider; use Selective\ImageType\Provider\VectorProvider; use SplFileObject; $file = new SplFileObject('example.jpg'); $detector = new ImageTypeDetector(); // Add image detectors $detector->addProvider(new HdrProvider()); $detector->addProvider(new RawProvider()); $detector->addProvider(new VectorProvider()); $detector->addProvider(new RasterProvider()); $imageType = $detector->getImageTypeFromFile($file); // Get the image format echo $imageType->getFormat(); // jpeg // Get the mime type echo $imageType->getMimeType(); // image/jpeg

Detect the image type of in-memory object

$image = new SplTempFileObject(); $image->fwrite('my file content'); $detector = new ImageTypeDetector(); // Add image detectors $detector->addProvider(new RasterProvider()); echo $detector->getImageTypeFromFile($file)->getFormat();

Similar libraries

License

  • MIT

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固