claviska/simpleimage
SimpleImage is a lightweight PHP 8+ GD image manipulation class. Load images from files/strings/URIs, auto-orient via EXIF, resize/crop/overlay/watermark, draw shapes/text, apply filters, and convert between GIF/JPEG/PNG/WEBP/BMP/AVIF. Chainable, exception-based.
claviska/simpleimage (v4.4.0) remains a lightweight GD-based library for basic-to-intermediate image manipulation, aligning well with Laravel’s image-handling needs (e.g., thumbnails, dynamic generation). The deprecation of ::reset() (due to PHP 8.5’s imagedestroy() deprecation) underscores its focus on modern PHP compatibility.Storage facade and queue systems. The package’s simplicity makes it ideal for performance-critical paths where Intervention/Imagick’s overhead is unnecessary.php-gd). Critical Update: PHP 8.5+ users must replace SimpleImage::reset() calls (now deprecated) with explicit imagedestroy() or rely on PHP’s auto-destruction (GD resources are freed at script end).app.php or a custom provider). Example:
$this->app->bind('simpleimage', function () {
return new \SimpleImage(); // No changes needed for instantiation.
});
SimpleImage::resize()) is still recommended for consistency.::reset() is deprecated. Mitigation:
imagedestroy($resource) where needed.SimpleImage::reset() usage. Add a deprecation warning in logs if detected.Allowed memory exhausted. Mitigation: Use queues + chunked processing.SimpleImage::reset() usage.composer require claviska/simpleimage:^4.4).Storage facade (local, S3, etc.).simpleimage.SimpleImage::reset() calls.config('image.driver') to switch implementations.simpleimage.SimpleImage::reset() with imagedestroy() in all custom wrappers.imagedestroy() deprecation.php:8.5 to CI matrix (e.g., GitHub Actions).memory_limit is adequate (e.g., 512M for large images).composer.json.SimpleImage::reset() in logs.SimpleImage::reset() usage in tests.Cache::remember).imagedestroy() usage in edge cases.phpstan/psalm to catch type-related issues.resize()).SimpleImage::error()).Xdebug to trace image processing bottlenecks.memory_limit and max_execution_time for large images.| Failure Scenario | Detection | Mitigation | RTO/RPO |
|---|---|---|---|
| GD extension missing | ClassNotFoundException |
Fallback to Imagick or error page. | RTO: <5 mins |
PHP 8.5+ imagedestroy() deprecation |
E_DEPRECATED warnings |
Replace SimpleImage::reset() with imagedestroy(). |
RTO: <15 mins |
| Memory exhaustion | AllowedMemoryExceeded |
Retry with smaller chunks or queue. | RPO: 0 (retry) |
| Corrupted input image | SimpleImage::error() |
Validate files via getimagesize(). |
RTO: <1 min |
| Queue worker crashes | Laravel Horizon monitoring | Circuit breaker + dead-letter queue. | RPO: 15 mins |
| Disk full | StorageException |
Alert + auto-archive old images. | RTO: 10 mins |
imagedestroy() usage.phpunit.xml:
<php>
<extension name="gd" />
</php>
SimpleImage::reset() deprecation).How can I help you explore Laravel packages today?