diff --git a/app/Http/ViewComposers/Logo.php b/app/Http/ViewComposers/Logo.php index ebdbf687a..bac2e43e6 100644 --- a/app/Http/ViewComposers/Logo.php +++ b/app/Http/ViewComposers/Logo.php @@ -32,9 +32,11 @@ class Logo $path = base_path('public/img/company.png'); } - $width = $height = setting('invoice.logo_size', 128); + $image = Image::cache(function($image) use ($path) { + $width = $height = setting('invoice.logo_size', 128); - $image = Image::make($path)->resize($width, $height)->encode()->getEncoded(); + $image->make($path)->resize($width, $height)->encode(); + }); if (empty($image)) { return $logo; diff --git a/composer.json b/composer.json index 6155ff46e..27837692d 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,7 @@ "graham-campbell/markdown": "12.0.*", "guzzlehttp/guzzle": "^6.5", "intervention/image": "2.5.*", + "intervention/imagecache": "^2.4", "kyslik/column-sortable": "^6.0", "laracasts/flash": "3.1.*", "laravel/framework": "^7.0", diff --git a/composer.lock b/composer.lock index c93bdad2e..4bacf291e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d1b643139c31f613261680c874c1d145", + "content-hash": "d5770340d17c7c145a2f78e3d22c25d8", "packages": [ { "name": "akaunting/firewall", @@ -998,16 +998,6 @@ "ssl", "tls" ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], "time": "2020-04-08T08:27:21+00:00" }, { @@ -2823,6 +2813,60 @@ ], "time": "2019-11-02T09:15:47+00:00" }, + { + "name": "intervention/imagecache", + "version": "2.4.2", + "source": { + "type": "git", + "url": "https://github.com/Intervention/imagecache.git", + "reference": "d3dadc8052702805ba2b8ffb11e0b05c1f5d2873" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/imagecache/zipball/d3dadc8052702805ba2b8ffb11e0b05c1f5d2873", + "reference": "d3dadc8052702805ba2b8ffb11e0b05c1f5d2873", + "shasum": "" + }, + "require": { + "illuminate/cache": "~4|~5|~6|~7", + "illuminate/filesystem": "~4|~5|~6|~7", + "intervention/image": "dev-master|~2,>=2.2.0", + "jeremeamia/superclosure": "~1|~2", + "nesbot/carbon": "^1.26.3 || ^2.0", + "php": ">=5.3.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.net", + "homepage": "http://olivervogel.net/" + } + ], + "description": "Caching extension for the Intervention Image Class", + "homepage": "http://image.intervention.io", + "keywords": [ + "cache", + "gd", + "image", + "imagick", + "laravel" + ], + "time": "2020-07-05T18:27:20+00:00" + }, { "name": "jaybizzle/crawler-detect", "version": "v1.2.96", @@ -2951,6 +2995,65 @@ ], "time": "2020-06-13T08:05:20+00:00" }, + { + "name": "jeremeamia/superclosure", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/jeremeamia/super_closure.git", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", + "php": ">=5.4", + "symfony/polyfill-php56": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "SuperClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia", + "role": "Developer" + } + ], + "description": "Serialize Closure objects, including their context and binding", + "homepage": "https://github.com/jeremeamia/super_closure", + "keywords": [ + "closure", + "function", + "lambda", + "parser", + "serializable", + "serialize", + "tokenizer" + ], + "abandoned": "opis/closure", + "time": "2018-03-21T22:21:57+00:00" + }, { "name": "justinrainbow/json-schema", "version": "5.2.10", @@ -8145,6 +8248,80 @@ ], "time": "2020-06-06T08:46:27+00:00" }, + { + "name": "symfony/polyfill-php56", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "13df84e91cd168f247c2f2ec82cc0fa24901c011" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/13df84e91cd168f247c2f2ec82cc0fa24901c011", + "reference": "13df84e91cd168f247c2f2ec82cc0fa24901c011", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, { "name": "symfony/polyfill-php72", "version": "v1.17.0", @@ -8370,6 +8547,76 @@ ], "time": "2020-06-06T08:46:27+00:00" }, + { + "name": "symfony/polyfill-util", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "46b910c71e9828f8ec2aa7a0314de1130d9b295a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/46b910c71e9828f8ec2aa7a0314de1130d9b295a", + "reference": "46b910c71e9828f8ec2aa7a0314de1130d9b295a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, { "name": "symfony/process", "version": "v5.1.2", @@ -9359,12 +9606,6 @@ "flare", "reporting" ], - "funding": [ - { - "url": "https://www.patreon.com/spatie", - "type": "patreon" - } - ], "time": "2020-03-02T15:52:04+00:00" }, { @@ -9828,20 +10069,6 @@ "php", "symfony" ], - "funding": [ - { - "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", - "type": "custom" - }, - { - "url": "https://github.com/nunomaduro", - "type": "github" - }, - { - "url": "https://www.patreon.com/nunomaduro", - "type": "patreon" - } - ], "time": "2020-04-04T19:56:08+00:00" }, { @@ -10421,12 +10648,6 @@ "highlight.php", "syntax" ], - "funding": [ - { - "url": "https://github.com/allejo", - "type": "github" - } - ], "time": "2020-03-02T05:59:21+00:00" }, { diff --git a/config/imagecache.php b/config/imagecache.php new file mode 100644 index 000000000..99a1cc8a2 --- /dev/null +++ b/config/imagecache.php @@ -0,0 +1,71 @@ + null, + + /* + |-------------------------------------------------------------------------- + | Storage paths + |-------------------------------------------------------------------------- + | + | The following paths will be searched for the image filename, submitted + | by URI. + | + | Define as many directories as you like. + | + */ + + 'paths' => array( + public_path('upload'), + public_path('images') + ), + + /* + |-------------------------------------------------------------------------- + | Manipulation templates + |-------------------------------------------------------------------------- + | + | Here you may specify your own manipulation filter templates. + | The keys of this array will define which templates + | are available in the URI: + | + | {route}/{template}/{filename} + | + | The values of this array will define which filter class + | will be applied, by its fully qualified name. + | + */ + + 'templates' => array( + 'small' => 'Intervention\Image\Templates\Small', + 'medium' => 'Intervention\Image\Templates\Medium', + 'large' => 'Intervention\Image\Templates\Large', + ), + + /* + |-------------------------------------------------------------------------- + | Image Cache Lifetime + |-------------------------------------------------------------------------- + | + | Lifetime in minutes of the images handled by the imagecache route. + | + */ + + 'lifetime' => 43200, + +);