Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ jobs:
exclude:
- php-version: "8.1"
symfony: '8.0.*'
operating-system: "ubuntu-latest"
- php-version: "8.2"
symfony: '8.0.*'
operating-system: "ubuntu-latest"
- php-version: "8.3"
symfony: '8.0.*'
operating-system: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install gifsicle
run: sudo apt-get update && sudo apt-get install -y gifsicle

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
Expand All @@ -84,7 +84,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ github.sha }}
Expand Down
8 changes: 6 additions & 2 deletions Command/GifOptimizerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
$optimizationLevel = $input->getOption('optimization_level');
$width = $input->getOption('resize_width');

if (!is_numeric($width)) {
throw new \Exception('Invalid width.');
}

$this->optimizer = OptimizerChainFactory::create()
->setOptimizers([
new Gifsicle([
'-b',
$optimizationLevel,
'--resize-width=' . $width,
\sprintf('--resize-width=%s', (string) $width),
]),
])
;
Expand All @@ -79,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$imageDir = $input->getArgument('image_dir');

if (!\is_string($imageDir) || !is_dir($imageDir)) {
throw new \RuntimeException($imageDir . ' is not a valid directory');
throw new \RuntimeException('image_dir is not a valid directory');
}

$pattern = $imageDir . '/*/*.gif';
Expand Down
2 changes: 1 addition & 1 deletion EventListener/ReplaceImageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function onKernelResponse(ResponseEvent $event): void
}

$exception = $event->getRequest()->attributes->get('exception');
if (!($exception instanceof \Throwable)) {
if (!$exception instanceof \Throwable) {
return;
}

Expand Down
Binary file modified Resources/public/images/403/dog-cat-stairs.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/403/gandalf.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/403/goat-motorbike.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/403/men-in-black-flash.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/404/confused-travolta.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/404/looping-bird.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/404/missing-stapler.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/404/nothing-to-see-here.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/athletic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/bottle.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/captain-america.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/car-accident.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/carousel-fail-o.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/castle.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/dunk.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/facepalm.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/garbage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/kangaroo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/nope.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/panda.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/pingou.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/plane.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/pool.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/images/other/tupper.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bin/optimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

$application = new Application('gifexception');
$application->add(new GifOptimizerCommand());
$application->addCommand(new GifOptimizerCommand());
$application
->setDefaultCommand('gifexception:optimize', true)
->run()
Expand Down
2 changes: 1 addition & 1 deletion tests/app/config/routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return function (RoutingConfigurator $routes): void {
return static function (RoutingConfigurator $routes): void {
$routes->add('test_routing_error', '/error-{status}')
->requirements(['status' => '\d+'])
->defaults(['_controller' => 'Joli\GifExceptionBundle\Tests\app\src\TestController::errorAction'])
Expand Down
Loading