- How do I install webplusm/gallery-json-media in Laravel?
- Run composer require webplusm/gallery-json-media, then publish the config and translations with the package's vendor:publish tags. Create or use a custom Filament panel theme and @import the package CSS into theme.css. Finally, add a nullable JSON column to each model, implement HasMedia, and add the trait and array cast.
- Does Gallery Json Media support Filament v4 and Laravel 11?
- The 4.x release line targets Filament v4 and requires PHP 8.2 or newer. The package has been evaluated with Laravel 11 through 13 and Filament v4 or v5, so confirm the exact Composer constraints for the branch you install. The README for this branch documents Filament V4.x usage.
- How does the package store images and documents without a media table?
- It stores media as a JSON array on the owning Eloquent model using the HasMedia trait and an array cast, with no media table or polymorphic relation. Images and documents are therefore record-owned and ordered rather than shared assets. This keeps setup light for CMS-style pages, posts, products, or banners but is not a central asset registry.
- How do I render gallery images and document links in Blade?
- Call getMedias() or getDocuments() on the model to get fluent Media objects, then use methods such as withView() and withImageProperties() to control rendering. The package also ships Blade components for images and document links. This keeps display decisions in your Blade views and lets you wrap the call site in your own view model.
- Can I use S3 or a private disk for gallery documents?
- No. The README states the package supports public disk visibility only and explicitly says no S3. The API exposes visibility(), but that does not make private documents or per-tenant isolation safe. Use a different media library if you need private contracts, invoices, ID documents, or non-public storage.
- How do I add custom properties or metadata to each media item?
- Custom properties let you attach extra information to each media item in the JSON payload. You can use them for things like captions, alt text, credits, or other per-image and per-document metadata. Keep in mind that the JSON shape is the de facto schema, so add contract tests around any custom keys you rely on.
- How do I configure GD or Imagick cropping for gallery images?
- Publish the config file and set images.driver to ImageDriver::Gd or ImageDriver::Imagick. The package uses spatie/image for cropping, so make sure the matching PHP image extension is installed. Review the published config after major upgrades in case new options are added.
- How do I upgrade to 5.5.0 and regenerate thumbnails and dimensions?
- Declare the models that hold media in the maintenance.models config array, then run php artisan gallery-json-media:regenerate. Use --thumbnails-only or --dimensions-only to limit the work. Skipping this after 5.5.0 leaves older images without recorded width and height and leaves previously generated enlarged thumbnails in place, so schedule the command as part of your upgrade runbook.
- Can I query all media of a type across models or reuse assets between records?
- No. Because media lives in JSON columns, there is no first-class Media entity for querying all assets of type X or reporting cross-record reuse. You can use JSON path queries, but shared or deduplicated assets, media-level permissions, and bulk reprocessing are outside the package's design. Choose a dedicated media library if those are requirements.
- Is Gallery Json Media a replacement for spatie/laravel-medialibrary?
- It is not a full media library replacement. Gallery Json Media is a lightweight, record-owned JSON media field for Filament forms plus a fluent Laravel rendering API, while spatie/laravel-medialibrary provides a central media table, polymorphic relations, conversions, and broader asset management. If you only need ordered public images and document links on CMS-style records, this package is simpler; if you need shared assets, private disks, or queryable media entities, use a media library.