update avatar lib

This commit is contained in:
Yuri Kuznetsov
2025-12-03 23:00:54 +02:00
parent d73a97373d
commit 64c2979a59
3 changed files with 135 additions and 62 deletions
+6 -1
View File
@@ -39,6 +39,7 @@ use Espo\Core\Exceptions\NotFoundSilent;
use Espo\Core\Utils\SystemUser; use Espo\Core\Utils\SystemUser;
use Espo\Entities\User; use Espo\Entities\User;
use GuzzleHttp\Psr7\Utils;
use LasseRafn\InitialAvatarGenerator\InitialAvatar; use LasseRafn\InitialAvatarGenerator\InitialAvatar;
use LasseRafn\StringScript; use LasseRafn\StringScript;
@@ -202,7 +203,11 @@ class Avatar extends Image
->setHeader('Content-Type', 'image/png') ->setHeader('Content-Type', 'image/png')
->setHeader('Etag', $etag); ->setHeader('Etag', $etag);
$response->writeBody($image->stream('png', 100)); $pointer = $image->toPng()->toFilePointer();
$stream = Utils::streamFor($pointer);
$response->writeBody($stream);
} }
private function composeCacheControlHeader(): string private function composeCacheControlHeader(): string
+6 -2
View File
@@ -50,13 +50,13 @@
"brick/phonenumber": "^0.5.0", "brick/phonenumber": "^0.5.0",
"picqer/php-barcode-generator": "^3.2", "picqer/php-barcode-generator": "^3.2",
"chillerlan/php-qrcode": "^5.0", "chillerlan/php-qrcode": "^5.0",
"lasserafn/php-initial-avatar-generator": "^4.4",
"tholu/php-cidr-match": "^0.5", "tholu/php-cidr-match": "^0.5",
"league/oauth2-client": "^2.9", "league/oauth2-client": "^2.9",
"symfony/mailer": "^6", "symfony/mailer": "^6",
"league/html-to-markdown": "^5.1", "league/html-to-markdown": "^5.1",
"psr/clock": "^1.0", "psr/clock": "^1.0",
"react/child-process": "^0.6.6" "react/child-process": "^0.6.6",
"lasserafn/php-initial-avatar-generator": "dev-update-image-lib#a46ab8f1427f93c5b37957e739205da7fcca0290"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^11.5", "phpunit/phpunit": "^11.5",
@@ -107,6 +107,10 @@
{ {
"type": "git", "type": "git",
"url": "https://github.com/yurikuzn/laminas-ldap.git" "url": "https://github.com/yurikuzn/laminas-ldap.git"
},
{
"type": "vcs",
"url": "https://github.com/yurikuzn/php-initial-avatar-generator.git"
} }
], ],
"provide": { "provide": {
Generated
+123 -59
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "bcd3f0a6aa65f644d19ca5d98552b5b7", "content-hash": "2652b24ce372a42ddcf977c5fa22b45f",
"packages": [ "packages": [
{ {
"name": "async-aws/core", "name": "async-aws/core",
@@ -1814,50 +1814,32 @@
"time": "2024-07-18T11:15:46+00:00" "time": "2024-07-18T11:15:46+00:00"
}, },
{ {
"name": "intervention/image", "name": "intervention/gif",
"version": "2.7.2", "version": "4.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Intervention/image.git", "url": "https://github.com/Intervention/gif.git",
"reference": "04be355f8d6734c826045d02a1079ad658322dad" "reference": "5999eac6a39aa760fb803bc809e8909ee67b451a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad", "url": "https://api.github.com/repos/Intervention/gif/zipball/5999eac6a39aa760fb803bc809e8909ee67b451a",
"reference": "04be355f8d6734c826045d02a1079ad658322dad", "reference": "5999eac6a39aa760fb803bc809e8909ee67b451a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-fileinfo": "*", "php": "^8.1"
"guzzlehttp/psr7": "~1.1 || ^2.0",
"php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "~0.9.2", "phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0",
}, "slevomat/coding-standard": "~8.0",
"suggest": { "squizlabs/php_codesniffer": "^3.8"
"ext-gd": "to use GD library based image processing.",
"ext-imagick": "to use Imagick based image processing.",
"intervention/imagecache": "Caching extension for the Intervention Image library"
}, },
"type": "library", "type": "library",
"extra": {
"laravel": {
"aliases": {
"Image": "Intervention\\Image\\Facades\\Image"
},
"providers": [
"Intervention\\Image\\ImageServiceProvider"
]
},
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Intervention\\Image\\": "src/Intervention/Image" "Intervention\\Gif\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@@ -1871,19 +1853,17 @@
"homepage": "https://intervention.io/" "homepage": "https://intervention.io/"
} }
], ],
"description": "Image handling and manipulation library with support for Laravel integration", "description": "Native PHP GIF Encoder/Decoder",
"homepage": "http://image.intervention.io/", "homepage": "https://github.com/intervention/gif",
"keywords": [ "keywords": [
"animation",
"gd", "gd",
"image", "gif",
"imagick", "image"
"laravel",
"thumbnail",
"watermark"
], ],
"support": { "support": {
"issues": "https://github.com/Intervention/image/issues", "issues": "https://github.com/Intervention/gif/issues",
"source": "https://github.com/Intervention/image/tree/2.7.2" "source": "https://github.com/Intervention/gif/tree/4.2.2"
}, },
"funding": [ "funding": [
{ {
@@ -1893,9 +1873,89 @@
{ {
"url": "https://github.com/Intervention", "url": "https://github.com/Intervention",
"type": "github" "type": "github"
},
{
"url": "https://ko-fi.com/interventionphp",
"type": "ko_fi"
} }
], ],
"time": "2022-05-21T17:30:32+00:00" "time": "2025-03-29T07:46:21+00:00"
},
{
"name": "intervention/image",
"version": "3.11.5",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "76e96d3809d53dd8d597005634a733d4b2f6c2c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/76e96d3809d53dd8d597005634a733d4b2f6c2c3",
"reference": "76e96d3809d53dd8d597005634a733d4b2f6c2c3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"intervention/gif": "^4.2",
"php": "^8.1"
},
"require-dev": {
"mockery/mockery": "^1.6",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^10.0 || ^11.0 || ^12.0",
"slevomat/coding-standard": "~8.0",
"squizlabs/php_codesniffer": "^3.8"
},
"suggest": {
"ext-exif": "Recommended to be able to read EXIF data properly."
},
"type": "library",
"autoload": {
"psr-4": {
"Intervention\\Image\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@intervention.io",
"homepage": "https://intervention.io"
}
],
"description": "PHP Image Processing",
"homepage": "https://image.intervention.io",
"keywords": [
"gd",
"image",
"imagick",
"resize",
"thumbnail",
"watermark"
],
"support": {
"issues": "https://github.com/Intervention/image/issues",
"source": "https://github.com/Intervention/image/tree/3.11.5"
},
"funding": [
{
"url": "https://paypal.me/interventionio",
"type": "custom"
},
{
"url": "https://github.com/Intervention",
"type": "github"
},
{
"url": "https://ko-fi.com/interventionphp",
"type": "ko_fi"
}
],
"time": "2025-11-29T11:18:34+00:00"
}, },
{ {
"name": "johngrogg/ics-parser", "name": "johngrogg/ics-parser",
@@ -2561,26 +2621,26 @@
}, },
{ {
"name": "lasserafn/php-initial-avatar-generator", "name": "lasserafn/php-initial-avatar-generator",
"version": "4.5", "version": "dev-update-image-lib",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/LasseRafn/php-initial-avatar-generator.git", "url": "https://github.com/yurikuzn/php-initial-avatar-generator.git",
"reference": "1a63213583a8694e781f7476345b096af6a14d08" "reference": "a46ab8f1427f93c5b37957e739205da7fcca0290"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/LasseRafn/php-initial-avatar-generator/zipball/1a63213583a8694e781f7476345b096af6a14d08", "url": "https://api.github.com/repos/yurikuzn/php-initial-avatar-generator/zipball/a46ab8f1427f93c5b37957e739205da7fcca0290",
"reference": "1a63213583a8694e781f7476345b096af6a14d08", "reference": "a46ab8f1427f93c5b37957e739205da7fcca0290",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"intervention/image": "^2.3", "intervention/image": "^3.11",
"lasserafn/php-initials": "^3.0", "lasserafn/php-initials": "^3.0",
"lasserafn/php-string-script-language": "^0.4", "lasserafn/php-string-script-language": "^0.4",
"meyfa/php-svg": "^0.9.0", "meyfa/php-svg": "^0.9.0",
"overtrue/pinyin": "^4.0", "overtrue/pinyin": "^4.0",
"php": "^7.0|^7.1|^7.2|^7.3|^7.4|^8.0|^8.1|^8.2" "php": "^8.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.5" "phpunit/phpunit": "^8.5"
@@ -2591,7 +2651,11 @@
"LasseRafn\\InitialAvatarGenerator\\": "src/" "LasseRafn\\InitialAvatarGenerator\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "autoload-dev": {
"psr-4": {
"InitialAvatarGenerator\\Tests\\": "tests/"
}
},
"license": [ "license": [
"MIT" "MIT"
], ],
@@ -2603,22 +2667,21 @@
], ],
"description": "A package to generate avatars with initials for PHP", "description": "A package to generate avatars with initials for PHP",
"keywords": [ "keywords": [
"Initials",
"avatar", "avatar",
"image", "image",
"initials",
"svg" "svg"
], ],
"support": { "support": {
"issues": "https://github.com/LasseRafn/php-initial-avatar-generator/issues", "source": "https://github.com/yurikuzn/php-initial-avatar-generator/tree/update-image-lib"
"source": "https://github.com/LasseRafn/php-initial-avatar-generator/tree/4.5"
}, },
"funding": [ "funding": [
{ {
"url": "https://opencollective.com/ui-avatars", "type": "open_collective",
"type": "open_collective" "url": "https://opencollective.com/ui-avatars"
} }
], ],
"time": "2025-10-06T08:39:05+00:00" "time": "2025-12-03T17:15:59+00:00"
}, },
{ {
"name": "lasserafn/php-initials", "name": "lasserafn/php-initials",
@@ -3850,13 +3913,13 @@
"type": "library", "type": "library",
"extra": { "extra": {
"hooks": { "hooks": {
"pre-commit": [
"composer test",
"composer fix-style"
],
"pre-push": [ "pre-push": [
"composer test", "composer test",
"composer check-style" "composer check-style"
],
"pre-commit": [
"composer test",
"composer fix-style"
] ]
} }
}, },
@@ -9844,6 +9907,7 @@
"laminas/laminas-ldap": 20, "laminas/laminas-ldap": 20,
"laminas/laminas-mail": 20, "laminas/laminas-mail": 20,
"laminas/laminas-mime": 20, "laminas/laminas-mime": 20,
"lasserafn/php-initial-avatar-generator": 20,
"zordius/lightncandy": 20 "zordius/lightncandy": 20
}, },
"prefer-stable": false, "prefer-stable": false,