Upgrade to 4.3.0

This commit is contained in:
Bastian Allgeier
2024-06-13 12:13:00 +02:00
parent 4b55753c46
commit e50c0341fc
87 changed files with 643 additions and 430 deletions

View File

@@ -116,15 +116,33 @@ class SimpleImage
*/
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.
*
@@ -313,7 +331,7 @@ class SimpleImage
*
* @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;