Skip to content

Commit 4e71e18

Browse files
committed
Support intervention/image v4 and drop v3
- Require intervention/image ^4.0 and bump PHP to ^8.3 (v4's floor); drop Laravel 9 / testbench 7 accordingly - Port to the v4 API: read()->decode(), encodeByExtension()->encodeUsingFileExtension(), greyscale()->grayscale(), and pickColor()->colorAt() in tests - Trim the CI matrix to PHP 8.3-8.5 - Add #[Override] attributes now surfaced by Rector under the 8.3 floor
1 parent 2b81932 commit 4e71e18

12 files changed

Lines changed: 23 additions & 41 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ ubuntu-latest ]
12-
php: [ 8.5, 8.4, 8.3, 8.2, 8.1, 8.0 ]
12+
php: [ 8.5, 8.4, 8.3 ]
1313
laravel: [ 13.*, 12.*, 11.*, 10.* ]
1414
stability: [ prefer-stable ]
1515
include:
@@ -24,24 +24,8 @@ jobs:
2424
exclude:
2525
- laravel: 13.*
2626
php: 8.3
27-
- laravel: 13.*
28-
php: 8.2
29-
- laravel: 13.*
30-
php: 8.1
31-
- laravel: 13.*
32-
php: 8.0
33-
- laravel: 12.*
34-
php: 8.1
35-
- laravel: 12.*
36-
php: 8.0
37-
- laravel: 11.*
38-
php: 8.1
39-
- laravel: 11.*
40-
php: 8.0
4127
- laravel: 10.*
4228
php: 8.5
43-
- laravel: 10.*
44-
php: 8.0
4529

4630
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
4731

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^8.1",
22-
"illuminate/console": "^9.0|^10.0|^11.0|^12.0|^13.0",
23-
"illuminate/support": "^9.0|^10.0|^11.0|^12.0|^13.0",
24-
"illuminate/routing": "^9.0|^10.0|^11.0|^12.0|^13.0",
25-
"intervention/image": "^3.6",
21+
"php": "^8.3",
22+
"illuminate/console": "^10.0|^11.0|^12.0|^13.0",
23+
"illuminate/support": "^10.0|^11.0|^12.0|^13.0",
24+
"illuminate/routing": "^10.0|^11.0|^12.0|^13.0",
25+
"intervention/image": "^4.0",
2626
"league/flysystem": "^3.0",
2727
"symfony/http-foundation": "^6.0|^7.0|^8.0",
2828
"symfony/http-kernel": "^6.0|^7.0|^8.0",
@@ -31,7 +31,7 @@
3131
"require-dev": {
3232
"phpunit/phpunit": "^9.5.10|^11.5.3|^12.5.12",
3333
"mockery/mockery": "^1.4.4",
34-
"orchestra/testbench": "^7.5|^8.0|^9.0|^10.0|^11.0",
34+
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
3535
"larastan/larastan": "^2.11.2|^3.9",
3636
"driftingly/rector-laravel": "^1.0|^2.1",
3737
"laravel/pint": "^1.0"

src/Commands/Purge.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
namespace Bkwld\Croppa\Commands;
66

77
use Bkwld\Croppa\Storage;
8+
use Illuminate\Console\Attributes\Description;
89
use Illuminate\Console\Command;
10+
use Override;
911
use Symfony\Component\Console\Input\InputOption;
1012

1113
/**
1214
* Delete all crops from the crops_disk.
1315
*/
16+
#[Description('Delete all crops')]
1417
class Purge extends Command
1518
{
1619
/**
@@ -20,13 +23,6 @@ class Purge extends Command
2023
*/
2124
protected $name = 'croppa:purge';
2225

23-
/**
24-
* The console command description.
25-
*
26-
* @var string
27-
*/
28-
protected $description = 'Delete all crops';
29-
3026
/**
3127
* Dependency inject.
3228
*/
@@ -51,6 +47,7 @@ public function handle(): void
5147
*
5248
* @return array<InputOption>
5349
*/
50+
#[Override]
5451
protected function getOptions(): array
5552
{
5653
return [

src/CroppaServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
use Illuminate\Contracts\Config\Repository;
99
use Illuminate\Routing\Router;
1010
use Illuminate\Support\ServiceProvider;
11+
use Override;
1112

1213
class CroppaServiceProvider extends ServiceProvider
1314
{
15+
#[Override]
1416
public function register(): void
1517
{
1618
// Bind the Croppa URL generator and parser.

src/Filters/BlackWhite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class BlackWhite implements FilterInterface
1010
{
1111
public function applyFilter(ImageInterface $image): ImageInterface
1212
{
13-
return $image->greyscale();
13+
return $image->grayscale();
1414
}
1515
}

src/Filters/Darkgray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class Darkgray implements FilterInterface
1010
{
1111
public function applyFilter(ImageInterface $image): ImageInterface
1212
{
13-
return $image->greyscale()->colorize(-50, -50, -50);
13+
return $image->grayscale()->colorize(-50, -50, -50);
1414
}
1515
}

src/Filters/OrangeWarhol.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class OrangeWarhol implements FilterInterface
1010
{
1111
public function applyFilter(ImageInterface $image): ImageInterface
1212
{
13-
return $image->greyscale()->brightness(50)->colorize(-10, -70, -100);
13+
return $image->grayscale()->brightness(50)->colorize(-10, -70, -100);
1414
}
1515
}

src/Filters/TurquoiseWarhol.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class TurquoiseWarhol implements FilterInterface
1010
{
1111
public function applyFilter(ImageInterface $image): ImageInterface
1212
{
13-
return $image->greyscale()->brightness(50)->colorize(-70, -10, -20);
13+
return $image->grayscale()->brightness(50)->colorize(-70, -10, -20);
1414
}
1515
}

src/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Image
2929
public function __construct(string $path, array $options = [])
3030
{
3131
$imageManager = new ImageManager(new Driver);
32-
$this->image = $imageManager->read($path);
32+
$this->image = $imageManager->decode($path);
3333
$this->interlace = $options['interlace'];
3434
$this->upsize = $options['upsize'];
3535
if (isset($options['quality']) && is_array($options['quality'])) {
@@ -247,6 +247,6 @@ private function getFormatFromPath(string $path): string
247247
*/
248248
public function get(): string
249249
{
250-
return (string) $this->image->encodeByExtension($this->format, progressive: $this->interlace, quality: $this->quality);
250+
return (string) $this->image->encodeUsingFileExtension($this->format, progressive: $this->interlace, quality: $this->quality);
251251
}
252252
}

src/Storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function path(string $path): string
152152
return $tmpDisk->path($path);
153153
}
154154

155-
// With Intervention 3, this will lead to a DecoderException ("Unable to decode input")
155+
// With Intervention Image, this will lead to a DecoderException ("Unable to decode input")
156156
// We should probably throw an exception here to inform the developer that a tmp_disk is required.
157157
return $filesystemAdapter->url($path);
158158
}

0 commit comments

Comments
 (0)