- How do I install claviska/simpleimage in a Laravel project?
- Run `composer require claviska/simpleimage` to install via Composer. Ensure PHP’s GD extension is enabled (check with `php -m | grep gd`). No Laravel-specific setup is needed beyond requiring the package.
- Does claviska/simpleimage support Laravel’s Storage facade for file handling?
- Yes, use Laravel’s Storage facade (e.g., `Storage::disk('public')->get('image.jpg')`) to load images from local, S3, or other storage backends. Pass the file contents to `fromString()` or save processed images via `toFile()` with a Storage path.
- Can I use this package for async image processing in Laravel queues?
- Absolutely. Dispatch a job (e.g., `ResizeImageJob`) with the image path, then process it in `handle()` using simpleimage. For large files, chunk processing or streaming may be needed to avoid memory limits.
- What Laravel versions does claviska/simpleimage support?
- The package has no hard Laravel dependencies but is tested with PHP 8.1+. Verify compatibility with your Laravel version (e.g., 10.x) by checking the [GitHub issues](https://github.com/claviska/SimpleImage/issues) for reported edge cases.
- How do I handle errors like ‘GD library not installed’ in production?
- Check your server’s PHP GD extension with `phpinfo()` or `php -m | grep gd`. If missing, enable it via your hosting provider (e.g., `sudo apt install php-gd` for Ubuntu) or use a fallback like Intervention Image if GD is unavailable.
- Is claviska/simpleimage thread-safe for Laravel Horizon queues?
- No, the library is not thread-safe by design. For multi-process environments like Horizon, ensure stateless usage (e.g., no shared resources) or implement locking (e.g., Redis) to prevent race conditions during concurrent image processing.
- Can I create a Laravel facade for claviska/simpleimage to simplify usage?
- Yes. Register a facade in `config/app.php` and create a `SimpleImageServiceProvider` to bind the class. Example: `SimpleImage::resize('image.jpg', 320, 200)->toFile('thumb.jpg')` for cleaner syntax.
- What formats does claviska/simpleimage support for reading/writing?
- The package supports GIF, JPEG, PNG, WEBP, BMP, and AVIF for both input and output. Use methods like `fromFile('image.avif')` or `toFile('output.webp', 'image/webp')` to convert between formats.
- How do I add a watermark or text overlay to an image in Laravel?
- Use the fluent API: `$image->fromFile('background.jpg')->overlay('watermark.png', 'center')->toFile('watermarked.jpg')` for images or `$image->drawText('Hello', 50, 50, 'red')->toFile('text.jpg')` for text with TTF fonts.
- What are the alternatives to claviska/simpleimage for Laravel?
- For advanced features (e.g., SVG, PDF, or AI filters), consider [Intervention Image](https://image.intervention.io/) (GD/Imagick) or [Laravel Image](https://spatie.be/docs/laravel-image). For microservices, self-host [Imagick](https://php.net/manual/en/book.imagick.php) or use cloud APIs like AWS ImageOptim.