overtrue/laravel-qcloud-content-audit
Laravel integration for Tencent Cloud content audit (QCloud CMS), helping you moderate user-generated text and images for sensitive or unsafe content. Simple configuration and an easy-to-use API make it quick to add content safety checks to Laravel apps.
This package (5.0.0) is an image-handling layer for Laravel: it wires up an image service (driver-selectable GD/Imagick), does proportional scaling to 300px, encodes PNG/JPEG, and ships the tms and ims validation rules. The 5.0.0 release is a hard modernisation cut — read the README upgrade section before touching anything else, because there is no in-place upgrade path from a pre-5 install.
Minimum steps for a new install:
composer.json constraints and your CI matrix first — this is the most common reason installation silently resolves to an old version.composer require the package, then do not register Intervention Image's own ImageServiceProvider. 5.0.0 fixes a binding conflict with Laravel 13's image service; registering the upstream provider manually re-introduces the collision.gd vs imagick). Confirm ext-gd or ext-imagick is actually present on every environment — including the queue workers, since image work is usually dispatched.ims/tms in a Form Request, let the service do the 300px proportional resize, and assert the resulting MIME type is image/png or image/jpeg.The fastest sanity check on a fresh checkout is a cold-boot request, not a unit test — the two bugs fixed in this release (unregistered rules on first use, provider binding) only surfaced in a genuine cold start.
Validate with the shipped rules, in Form Requests. tms and ims are the package's own rules; keep them in a Form Request rather than the controller so the failure messages stay consistent across upload endpoints. Because 5.0.0 fixes first-use registration, you can now reference the rule string directly without a warm-up request or a manual Validator::extend call.
Resolve the image service from the container, don't instantiate it. The whole point of the 5.0.0 binding fix is that the driver choice comes from config through the container. Injecting the service (or a facade) keeps GD/Imagick swappable per environment — GD locally, Imagick in production if you need better resampling quality or format coverage.
Treat 300px as a default, not a constant. The proportional scaling to 300px is retained behaviour, but different upload surfaces (avatar vs. cover image vs. thumbnail) rarely want the same edge. Wrap the package call in a small application-level ImageUploader/action class so a future size change is one file, not a grep across controllers.
Pipeline shape: validate in Form Request → move to a temp/tmp disk → hand the path to the image service → store the encoded result on the public/private disk → persist the path. Keep the originating upload and the derived image separate; you will want to re-derive at a different size later without re-uploading.
Test both drivers in CI. The release notes confirm GD and Imagick are both covered by the suite. Mirror that: a matrix leg per driver catches the classic "works on GD, colour-shifts or fails on Imagick" class of bug, especially with palette PNGs and transparency. If a full matrix is too slow, at minimum run Imagick on the branch that touches image code.
Config caching. Run php artisan config:cache in the deploy step like any Laravel package, but be aware the driver is read from config — a stale cached config after switching extensions is a five-minute debugging session you don't need.
Image API directly (not through this package), those call sites need rewriting. v4 changed method signatures, the manager/instantiation model, and encoder handling. Grep for Intervention\Image and Image::make( before you start; that list is your migration estimate.ImageServiceProvider registration. Both a stale entry in config/app.php and a leftover entry in bootstrap/providers.php will bite you in Laravel 13. If you see "target class does not exist" or a double-bound image service, look here first..webp source will be honoured; it will be re-encoded to one of the two.memory_limit on a queue worker is the most likely production failure mode; set the limit per-worker rather than raising it globally.How can I help you explore Laravel packages today?