Skip to content

Commit

Permalink
Update composer dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora committed Jun 25, 2024
1 parent 3de440f commit c8cdb98
Show file tree
Hide file tree
Showing 19 changed files with 439 additions and 120 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"claviska/simpleimage": "4.0.6",
"claviska/simpleimage": "4.2.0",
"composer/semver": "3.4.0",
"filp/whoops": "2.15.4",
"getkirby/composer-installer": "^1.2.1",
"laminas/laminas-escaper": "2.13.0",
"michelf/php-smartypants": "1.8.1",
"phpmailer/phpmailer": "6.8.1",
"symfony/polyfill-intl-idn": "1.28.0",
"symfony/polyfill-mbstring": "1.28.0",
"symfony/yaml": "5.4.30 || 6.4.8"
"phpmailer/phpmailer": "6.9.1",
"symfony/polyfill-intl-idn": "1.30.0",
"symfony/polyfill-mbstring": "1.30.0",
"symfony/yaml": "6.4.8"
},
"replace": {
"symfony/polyfill-php72": "*"
Expand Down
57 changes: 26 additions & 31 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 32 additions & 8 deletions vendor/claviska/simpleimage/src/claviska/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,33 @@ public function __construct(string $image = '', array $flags = [])
*/
public function __destruct()
{
if ($this->image instanceof GdImage) {
imagedestroy($this->image);
}
$this->reset();
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////////////////////////////////////////////////////

/**
* Checks if the SimpleImage object has loaded an image.
*/
public function hasImage(): bool
{
return $this->image instanceof GdImage;
}

/**
* Destroys the image resource.
*/
public function reset(): static
{
if ($this->hasImage()) {
imagedestroy($this->image);
}

return $this;
}

/**
* Set flag value.
*
Expand Down Expand Up @@ -313,7 +331,7 @@ public function fromString(string $string): SimpleImage|static
*
* @throws Exception Thrown when WEBP support is not enabled or unsupported format.
*/
protected function generate(string $mimeType = null, array|int $options = []): array
public function generate(string $mimeType = null, array|int $options = 100): array
{
// Format defaults to the original mime type
$mimeType = $mimeType ?: $this->mimeType;
Expand Down Expand Up @@ -1616,12 +1634,12 @@ public function dot(int $x, int $y, string|array $color): static
* @param int $width The ellipse width.
* @param int $height The ellipse height.
* @param string|array $color The ellipse color.
* @param int|array $thickness Line thickness in pixels or 'filled' (default 1).
* @param string|int|array $thickness Line thickness in pixels or 'filled' (default 1).
* @return SimpleImage
*
* @throws Exception
*/
public function ellipse(int $x, int $y, int $width, int $height, string|array $color, int|array $thickness = 1): static
public function ellipse(int $x, int $y, int $width, int $height, string|array $color, string|int|array $thickness = 1): static
{
// Allocate the color
$tempColor = $this->allocateColor($color);
Expand Down Expand Up @@ -2337,18 +2355,24 @@ public static function normalizeColor(string|array $color): array
$hex = strval(preg_replace('/^#/', '', $color));

// Support short and standard hex codes
if (strlen($hex) === 3) {
if (strlen($hex) === 3 || strlen($hex) === 4) {
[$red, $green, $blue] = [
$hex[0].$hex[0],
$hex[1].$hex[1],
$hex[2].$hex[2],
];
} elseif (strlen($hex) === 6) {
if (strlen($hex) === 4) {
$alpha = hexdec($hex[3]) / 255;
}
} elseif (strlen($hex) === 6 || strlen($hex) === 8) {
[$red, $green, $blue] = [
$hex[0].$hex[1],
$hex[2].$hex[3],
$hex[4].$hex[5],
];
if (strlen($hex) === 8) {
$alpha = hexdec($hex[6].$hex[7]) / 255;
}
} else {
throw new Exception("Invalid color value: $color", self::ERR_INVALID_COLOR);
}
Expand Down
Loading

0 comments on commit c8cdb98

Please sign in to comment.