Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DX by specifying namespace for GD functions #274

Merged
merged 1 commit into from
Aug 22, 2024
Merged
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
20 changes: 10 additions & 10 deletions src/Drivers/Gd/GdDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,20 @@ public function save(?string $path = null): static
case 'jpg':
case 'jpeg':
case 'jfif':
imagejpeg($this->image, $path, $this->quality);
\imagejpeg($this->image, $path, $this->quality);
break;
case 'png':
imagepng($this->image, $path, $this->pngCompression());
\imagepng($this->image, $path, $this->pngCompression());
break;
case 'gif':
imagegif($this->image, $path);
\imagegif($this->image, $path);
break;
case 'webp':
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
imagewebp($this->image, $path, $quality);
\imagewebp($this->image, $path, $quality);
break;
case 'avif':
imageavif($this->image, $path, $this->quality);
\imageavif($this->image, $path, $this->quality);
break;
default:
throw UnsupportedImageFormat::make($extension);
Expand All @@ -188,19 +188,19 @@ public function base64(string $imageFormat = 'jpeg', bool $prefixWithFormat = tr
case 'jpg':
case 'jpeg':
case 'jfif':
imagejpeg($this->image, null, $this->quality);
\imagejpeg($this->image, null, $this->quality);
break;
case 'png':
imagepng($this->image, null, $this->pngCompression());
\imagepng($this->image, null, $this->pngCompression());
break;
case 'gif':
imagegif($this->image, null);
\imagegif($this->image, null);
break;
case 'webp':
imagewebp($this->image, null);
\imagewebp($this->image, null);
break;
case 'avif':
imageavif($this->image, null);
\imageavif($this->image, null);
break;
default:
throw UnsupportedImageFormat::make($imageFormat);
Expand Down