Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

File Image Laravel Package

rekalogika/file-image

Adds image support to rekalogika/file: image files are identified, validated, and can be resized or converted into derivatives such as thumbnails. Works with the file abstraction, so dimensions, MIME type, and metadata are available wherever files are used in your PHP app.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. This is not a standalone imaging library — it is a filter plugin for rekalogika/file, a filesystem-abstraction + attachment/metadata + filter-pipeline library. Its entire public surface is essentially one filter class that accepts a max width, max height, and a square-crop flag, and delegates the actual pixel work to the parent package's image-processing contract. That means the package's architectural value is conditional on adopting rekalogika/file as your attachment model. If your application already stores files as Doctrine entities/attributes wrapped by that library, this is a natural, low-ceremony addition. If your application uses Laravel's Storage facade + HasMedia-style models or Spatie's media library, this package sits on the wrong side of an abstraction boundary and you would be adopting a whole parent framework to get one resize call.

Integration feasibility. Mechanically straightforward: composer require, wire the filter into the parent library's filter registry, invoke with three arguments. The real cost sits in the prerequisites — the parent rekalogika/file package, a Flysystem adapter bound to your storage, and a working GD or Imagick extension in every environment that renders images (including queue workers and CI). Budget the majority of integration effort against the parent, not this package.

Stack-fit caveat. The task framing says "Laravel/PHP package," but the rekalogika family is Symfony/Doctrine-leaning (rekalogika/file-bundle, Doctrine listeners, Flysystem). Laravel support is DIY: you will hand-roll the container bindings and storage adapter. Do not assume a Laravel service provider ships with it — verify before committing.

Technical risk. High, concentrated in supply chain rather than code quality:

  • Bus factor 1. Single-maintainer ecosystem; no organizational backing.
  • Adoption signal is essentially zero — 1 star, 0 dependents, opportunity score in the low double digits. That is a leading indicator for "no community-vetted answers when you hit an edge case."
  • Read-only split repo. This is a subtree split from a monorepo. The issue tracker here is inert; PRs and bug reports must go upstream. Release tags are bound to monorepo tags, which typically means no independent semver guarantees for this subpackage and occasional version gaps.
  • Synchronous, in-request processing. Resizing happens on the call path unless you wrap it in a job. Large uploads become a memory/CPU DoS vector (memory_limit exhaustion from a 40MP JPEG is a realistic outage).
  • No derivative cache or srcset generation of its own. Responsive image sets mean N filter invocations; caching semantics belong to the parent package and must be validated.
  • Format ceiling. Assume JPEG/PNG/GIF/WebP via GD or Imagick; AVIF support depends on the PHP build, and there is no evidence of focal-point cropping, EXIF orientation handling, or animated-GIF policy in this thin wrapper.

Key questions to answer before any commitment:

  1. Are we already on rekalogika/file, or are we about to adopt a second attachment abstraction alongside Laravel's filesystem?
  2. Which image backend — GD or Imagick — and is it present, identically versioned, in local, CI, queue, and production images?
  3. Where does resizing execute — request path, queue job, or upload-time preprocessing — and what is our p95 image size and memory ceiling?
  4. Does the parent's filter layer cache derivatives by content hash, or do we re-encode on every request?
  5. What is the maintainer's release cadence and issue-response history in the monorepo over the last 12 months?
  6. What are our format requirements (AVIF, animated GIF, alpha-preserving resize) and does the backend satisfy them?
  7. Who owns this code if the upstream goes dormant — can we vendor and fork it?
  8. Does licensing/attribution (MIT) impose anything on our distribution model? (No, but confirm vendoring policy.)

Integration Approach

Stack fit. Treat this as a capability, not a dependency. The correct integration shape is to place it behind an interface you own:

App\Imaging\ImageTransformer  (your interface: resize(File, maxW, maxH, crop): File)
    └── RekalogikaImageTransformer   (adapter, the only file importing the package)
    └── InterventionImageTransformer (fallback / swap target)

This costs one afternoon and converts a bus-factor-1 dependency into an interchangeable detail.

Migration path. Two viable routes, chosen by whether you already own the parent abstraction:

  • Route A — already on rekalogika/file: greenfield filter adoption. Add the package, register the filter, migrate the highest-traffic image call sites one at a time behind your new interface. Low risk.
  • Route B — Laravel-native today. Do not adopt the whole parent library for resizing alone. Instead, port the filter's semantics (max-width / max-height / square-crop) onto Intervention Image or spatie/image (~50 lines), and keep this repo open as a reference implementation. Route B is the recommendation for the overwhelmingly common case, and it is the cheaper path even accounting for writing the code.

Compatibility checks (gate items, not nice-to-haves):

  • PHP version floor versus your runtime and your framework's supported matrix.
  • Parent rekalogika/file version constraint — pin exact, since subpackage tags track the monorepo.
  • Flysystem major version alignment (v1 vs v3 adapters are not interchangeable).
  • Ext-GD/Imagick availability and memory limits across all runtime contexts, not just web.
  • Confirm whether Laravel's filesystem can be bound to the parent's storage contract, or whether you need a bridging adapter package.

Sequencing.

  1. Spike (≤2 days). Stand up a throwaway branch: install parent + this package, run resize against 20 representative production images (largest, most color-varying, EXIF-rotated, CMYK, transparent PNG, animated GIF). Capture output dimensions, file sizes, peak memory, wall time.
  2. Decide Route A vs B based on the spike's ergonomics, not on the star count.
  3. Define the internal interface and land the adapter behind a feature flag with the fallback implementation wired but inactive.
  4. Move execution off the request path. Resize in a queued job on upload; store derivatives under a deterministic key; serve from CDN/storage directly.
  5. Add guardrails: max upload bytes, max pixel dimensions, mime allowlist, decode timeout, and a per-derivative size ceiling.
  6. Cut over call sites incrementally, with a metric on resize latency and failure rate per call site.
  7. Decommission whichever implementation lost, deleting the flag.

Operational Impact

Maintenance. Low code churn (thin wrapper) but non-zero process overhead: you must watch the monorepo release feed, not this repo, and pin exact versions because subpackage tags move with the parent. Vendor or fork on day one if the spike passes — the cost is one composer.json repository entry and it eliminates the "upstream archived, we can't ship a security patch" scenario. Expect to own the code within 12–18 months either way.

Support. Community-only, effectively single-maintainer, with no searchable issue corpus at this package's adoption level. Internalize the expectation that your team is the tier-2 support for this filter. That is acceptable for ~a resize call; it is not acceptable if imaging is on a revenue-critical path (marketplace listings, user avatars at scale, document previews).

Scaling. Resizing is CPU- and memory-bound, not I/O-bound, and it scales linearly with upload volume unless derivatives are cached. Concretely:

  • Always cache derivatives keyed on (source hash, maxW, maxH, crop). Without this, a listing page with 24 thumbnails re-decodes the same originals on every render.
  • Always queue, with a dedicated worker pool sized for memory, not CPU count — one 40MP decode can consume 200–400MB.
  • Precompute at upload for known variants rather than lazily on first request; lazy generation produces a thundering herd on cache flush and a bad first-paint experience.
  • Offload to a CDN with on-the-fly transforms (Cloudflare Images, imgix, Thumbor) if volume exceeds roughly a few hundred thousand derivatives/month; at that point the marginal value of an in-PHP filter is negative.

Failure modes to instrument and alert on:

  • Memory exhaustion / fatal on oversized decode — mitigate with pixel-count pre-check via getimagesize before decoding.
  • Corrupt or truncated source files surfacing as uncaught exceptions mid-render — wrap and fall back to a placeholder asset.
  • Truncated or blank derivatives written to cache (partial writes) — write to temp then atomic-rename.
  • Silent quality regressions: wrong crop anchor on faces, EXIF-rotated photos appearing sideways, animated GIFs flattened to frame 1, transparency flattened to black on JPEG output.
  • Backend divergence between GD and Imagick producing different crop math — pin one backend per environment and assert it at boot.
  • Queue saturation: a bulk import of 50k images starving interactive resizes — separate queue and concurrency pool.
  • Cache stampede after a bucket migration or cache-key schema change.

Ramp-up. The API surface is trivial — an engineer understands it in under an hour. The real ramp-up is the parent rekalogika/file model: file abstractions, filters, metadata, and Flysystem binding, which is a multi-day mental model for a team not already on it. That asymmetry — one-hour API, multi-day substrate — is the single strongest argument for Route B. If you do adopt it, assign one engineer as owner, have them write a one-page runbook covering the failure modes above, and require the fallback implementation to remain compiled and tested so a swap is a config change rather than a migration.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource