diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9173050b8..fe18139a2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.3', '8.4', '8.5' ] + php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] imagemagick: [ '6.9.13-50', '7.1.2-25' ] imagick: [ '3.8.1' ] diff --git a/Dockerfile b/Dockerfile index 4b0569aeb..43367a2e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3-cli +FROM php:8.1-cli ARG IMAGEMAGICK_VERSION=7.1.2-25 diff --git a/composer.json b/composer.json index 0a9493db1..45063beba 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "intervention/image", + "name": "openregion/image", "description": "PHP Image Processing", - "homepage": "https://image.intervention.io", + "homepage": "https://github.com/openregion/image", "keywords": [ "image", "gd", @@ -16,15 +16,22 @@ "name": "Oliver Vogel", "email": "oliver@intervention.io", "homepage": "https://intervention.io" + }, + { + "name": "CIT Open Region", + "homepage": "https://www.openregion.info/" } ], "require": { - "php": "^8.3", + "php": "^8.1", "ext-mbstring": "*", - "intervention/gif": "^5" + "openregion/gif": "^5.0" + }, + "replace": { + "intervention/image": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^12.0", + "phpunit/phpunit": "^10.5 || ^11.0 || ^12.0", "mockery/mockery": "^1.6", "phpstan/phpstan": "^2.1", "squizlabs/php_codesniffer": "^4", diff --git a/readme.md b/readme.md index d97718065..d8e4f6d56 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,9 @@ # Intervention Image ## PHP Image Processing -[![Latest Version](https://img.shields.io/packagist/v/intervention/image.svg)](https://packagist.org/packages/intervention/image) -[![Build Status](https://github.com/Intervention/image/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Intervention/image/actions) -[![Monthly Downloads](https://img.shields.io/packagist/dm/intervention/image.svg)](https://packagist.org/packages/intervention/image/stats) +[![Latest Version](https://img.shields.io/packagist/v/openregion/image.svg)](https://packagist.org/packages/openregion/image) +[![Build Status](https://github.com/openregion/image/actions/workflows/run-tests.yml/badge.svg)](https://github.com/openregion/image/actions) +[![Monthly Downloads](https://img.shields.io/packagist/dm/openregion/image.svg)](https://packagist.org/packages/openregion/image/stats) [![Support me on Ko-fi](https://raw.githubusercontent.com/Intervention/image/develop/.github/images/support.svg)](https://ko-fi.com/interventionphp) Intervention Image is a **PHP image processing library** that provides a simple @@ -11,6 +11,8 @@ and expressive way to create, edit, and compose images. It comes with a universa interface for the popular PHP image manipulation extensions. You can choose between the GD library, Imagick or libvips as the base layer for all operations. +This repository contains the `openregion/image` fork maintained for PHP 8.1+ compatibility. + - Fluent interface for common image editing tasks - Interchangeable driver architecture with support for **GD, Imagick and libvips** - Support for animated images with all drivers @@ -21,7 +23,7 @@ choose between the GD library, Imagick or libvips as the base layer for all oper Install this library using [Composer](https://getcomposer.org). Add the package with the following command: ```bash -composer require intervention/image +composer require openregion/image ``` ## Getting Started @@ -61,7 +63,7 @@ $encoded->save('images/example.jpg'); Ensure that your server environment meets the following requirements before installation: -- PHP >= 8.3 +- PHP >= 8.1 - Mbstring PHP Extension - Image Processing PHP Extension (GD, Imagick or libvips) @@ -82,6 +84,8 @@ If you discover any security related issues, please email oliver@intervention.io This library is developed and maintained by [Oliver Vogel](https://intervention.io) +This fork is co-maintained by [CIT Open Region](https://www.openregion.info/). + Thanks to the community of [contributors](https://github.com/Intervention/image/graphs/contributors) who have helped to improve this project. ## License diff --git a/src/Colors/Cmyk/Decoders/StringColorDecoder.php b/src/Colors/Cmyk/Decoders/StringColorDecoder.php index c1de46cba..bf178be42 100644 --- a/src/Colors/Cmyk/Decoders/StringColorDecoder.php +++ b/src/Colors/Cmyk/Decoders/StringColorDecoder.php @@ -12,7 +12,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface { - private const string PATTERN = + private const PATTERN = '/^cmyk ?\(' . '(?P[0-9\.]+%?)((, ?)| )' . '(?P[0-9\.]+%?)((, ?)| )' . diff --git a/src/Colors/Hsl/Decoders/StringColorDecoder.php b/src/Colors/Hsl/Decoders/StringColorDecoder.php index 64efffa26..d186e05c1 100644 --- a/src/Colors/Hsl/Decoders/StringColorDecoder.php +++ b/src/Colors/Hsl/Decoders/StringColorDecoder.php @@ -15,7 +15,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern of HSL color syntax */ - private const string PATTERN = + private const PATTERN = '/^hsla? ?\( ?' . '(?P[0-9\.]+)(?:deg)?((, ?)| )' . '(?P[0-9\.]+%?)((, ?)| )' . diff --git a/src/Colors/Hsv/Decoders/StringColorDecoder.php b/src/Colors/Hsv/Decoders/StringColorDecoder.php index 12a5d776e..513d96da1 100644 --- a/src/Colors/Hsv/Decoders/StringColorDecoder.php +++ b/src/Colors/Hsv/Decoders/StringColorDecoder.php @@ -15,7 +15,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern of hsv/b color syntax. */ - private const string PATTERN = + private const PATTERN = '/^hs(v|b) ?\( ?(' . '?P[0-9\.]+)(?:deg)?((, ?)| )' . '(?P[0-9\.]+%?)((, ?)| )' . diff --git a/src/Colors/Oklab/Decoders/StringColorDecoder.php b/src/Colors/Oklab/Decoders/StringColorDecoder.php index a93317ccd..c8d1371fa 100644 --- a/src/Colors/Oklab/Decoders/StringColorDecoder.php +++ b/src/Colors/Oklab/Decoders/StringColorDecoder.php @@ -18,7 +18,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern of oklab color syntax. */ - private const string PATTERN = + private const PATTERN = '/^oklab ?\( ?' . '(?P(1|0|0?\.[0-9]+)|[0-9\.]+%)((, ?)|( ))' . '(?P(-?0|-?0?\.[0-9\.]+)|(-?[0-9\.]+%))((, ?)|( ))' . diff --git a/src/Colors/Oklch/Decoders/StringColorDecoder.php b/src/Colors/Oklch/Decoders/StringColorDecoder.php index a448acca4..d20f2e252 100644 --- a/src/Colors/Oklch/Decoders/StringColorDecoder.php +++ b/src/Colors/Oklch/Decoders/StringColorDecoder.php @@ -18,7 +18,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern for oklch color syntax. */ - protected const string PATTERN = + protected const PATTERN = '/^oklch ?\( ?' . '(?P(1|0|0?\.[0-9]+)|[0-9\.]+%)((, ?)|( ))' . '(?P(-?0|-?0?\.[0-9\.]+)|(-?[0-9\.]+%))((, ?)|( ))' . diff --git a/src/Colors/Rgb/Decoders/HexColorDecoder.php b/src/Colors/Rgb/Decoders/HexColorDecoder.php index bf5a02733..2845b7805 100644 --- a/src/Colors/Rgb/Decoders/HexColorDecoder.php +++ b/src/Colors/Rgb/Decoders/HexColorDecoder.php @@ -16,7 +16,7 @@ class HexColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern of hexadecimal color syntax. */ - protected const string PATTERN = '/^#?(?P[a-f\d]{3}(?:[a-f\d]?|(?:[a-f\d]{3}(?:[a-f\d]{2})?)?)\b)$/i'; + protected const PATTERN = '/^#?(?P[a-f\d]{3}(?:[a-f\d]?|(?:[a-f\d]{3}(?:[a-f\d]{2})?)?)\b)$/i'; /** * {@inheritdoc} diff --git a/src/Colors/Rgb/Decoders/StringColorDecoder.php b/src/Colors/Rgb/Decoders/StringColorDecoder.php index 85ba9f71b..0d7a8c716 100644 --- a/src/Colors/Rgb/Decoders/StringColorDecoder.php +++ b/src/Colors/Rgb/Decoders/StringColorDecoder.php @@ -16,7 +16,7 @@ class StringColorDecoder extends AbstractDecoder implements DecoderInterface /** * Regex pattern of rgb color syntax. */ - private const string PATTERN = + private const PATTERN = '/^s?rgba? ?\( ?' . '(?P[0-9]{1,3})([, ]) ?' . '(?P[0-9]{1,3})\2 ?' . diff --git a/src/DataUri.php b/src/DataUri.php index 105502b6a..13091f61c 100644 --- a/src/DataUri.php +++ b/src/DataUri.php @@ -13,7 +13,7 @@ class DataUri implements DataUriInterface /** * Pattern of data uri scheme. */ - protected const string PATTERN = "/^data:(?P\w+\/[-+.\w]+)?" . + protected const PATTERN = "/^data:(?P\w+\/[-+.\w]+)?" . "(?P(;[-\w]+=[-\w]+)*)(?P;base64)?,(?P.*)/"; /** diff --git a/src/Drivers/AbstractEncoder.php b/src/Drivers/AbstractEncoder.php index 5e6681b27..24cf6ef35 100644 --- a/src/Drivers/AbstractEncoder.php +++ b/src/Drivers/AbstractEncoder.php @@ -21,7 +21,7 @@ abstract class AbstractEncoder implements EncoderInterface /** * Default encoding quality. */ - public const int DEFAULT_QUALITY = 75; + public const DEFAULT_QUALITY = 75; /** * {@inheritdoc} diff --git a/src/InputHandler.php b/src/InputHandler.php index d2df7b5fd..807b15556 100644 --- a/src/InputHandler.php +++ b/src/InputHandler.php @@ -37,7 +37,7 @@ class InputHandler implements InputHandlerInterface /** * All available image decoders. */ - public const array IMAGE_DECODERS = [ + public const IMAGE_DECODERS = [ ImageObjectDecoder::class, NativeObjectDecoder::class, StreamImageDecoder::class, @@ -52,7 +52,7 @@ class InputHandler implements InputHandlerInterface /** * All available color decoders. */ - public const array COLOR_DECODERS = [ + public const COLOR_DECODERS = [ NamedColorDecoder::class, ColorObjectDecoder::class, RgbHexColorDecoder::class, diff --git a/tests/Feature/AutoOrientationTest.php b/tests/Feature/AutoOrientationTest.php index 2a56077df..1d45ddfbe 100644 --- a/tests/Feature/AutoOrientationTest.php +++ b/tests/Feature/AutoOrientationTest.php @@ -16,14 +16,14 @@ class AutoOrientationTest extends BaseTestCase { - private const array LANDSCAPE_TOP_LEFT = [2, 2]; - private const array LANDSCAPE_TOP_RIGHT = [50, 2]; - private const array LANDSCAPE_BOTTOM_LEFT = [2, 20]; - private const array LANDSCAPE_BOTTOM_RIGHT = [50, 20]; - private const array PORTRAIT_TOP_LEFT = [2, 2]; - private const array PORTRAIT_TOP_RIGHT = [20, 2]; - private const array PORTRAIT_BOTTOM_LEFT = [2, 50]; - private const array PORTRAIT_BOTTOM_RIGHT = [20, 50]; + private const LANDSCAPE_TOP_LEFT = [2, 2]; + private const LANDSCAPE_TOP_RIGHT = [50, 2]; + private const LANDSCAPE_BOTTOM_LEFT = [2, 20]; + private const LANDSCAPE_BOTTOM_RIGHT = [50, 20]; + private const PORTRAIT_TOP_LEFT = [2, 2]; + private const PORTRAIT_TOP_RIGHT = [20, 2]; + private const PORTRAIT_BOTTOM_LEFT = [2, 50]; + private const PORTRAIT_BOTTOM_RIGHT = [20, 50]; /** * @param array, 'colors': array}> $colors