Download the PHP package blackpig-creatif/chambre-noir without Composer
On this page you can find all versions of the php package blackpig-creatif/chambre-noir. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blackpig-creatif/chambre-noir
More information about blackpig-creatif/chambre-noir
Files in blackpig-creatif/chambre-noir
Package chambre-noir
Short Description Automatic image conversion and optimization for Filament FileUpload fields
License MIT
Informations about the package chambre-noir
ChambreNoir
Automatic image conversion, responsive images, attribution, and gallery management for FilamentPHP v5.
ChambreNoir extends Filament's FileUpload with automatic image conversions on upload, responsive image rendering via <picture> and srcset, and built-in photographer attribution. The core upload feature stores JSON in any column with no additional tables. The optional Gallery system adds first-class entities for managing curated image collections.
Requirements
- PHP 8.2+
- Laravel 11+ / 12+
- FilamentPHP 4+ / 5+
- Imagick PHP extension
- Intervention Image 3.x
Installation
Publish the config (optional):
Quick Start
1. Create a Conversion Preset
This generates app/BlackpigCreatif/ChambreNoir/Conversions/HeroConversion.php:
2. Use in a Filament Form
3. Add the Trait to Your Model
4. Render in Blade
How It Works
When an image is uploaded through RetouchMediaUpload:
- Filament's
FileUploadsaves the original to disk - ChambreNoir creates conversions based on the preset
- A JSON structure is stored in the database column
Old images are automatically cleaned up when replaced or removed.
RetouchMediaUpload
Drop-in replacement for Filament's FileUpload. Image-only by default.
Conversions via Preset (Recommended)
Inline Conversions
Config-based Presets (Legacy)
String keys reference config/chambre-noir.php presets. BaseConversion classes are preferred for new projects.
Disable Conversions
All standard FileUpload methods (disk(), directory(), imageEditor(), maxSize(), etc.) work as expected.
Conversion Presets
Presets define the image sizes generated on upload. Extend BaseConversion and implement define():
Each conversion accepts width, height, fit, and quality. Missing values inherit from class defaults.
Fit Methods
| Fit | Behaviour | Use case |
|---|---|---|
crop |
Exact dimensions, crops overflow | Thumbnails, avatars |
contain |
Fits within bounds, preserves ratio | General images |
max |
Scales down only, never up | Responsive images |
fill |
Fills dimensions, may distort | Background fills |
Composition
Presets can include other presets via includes():
Included conversions are merged first; the defining class can override them.
Responsive Configuration
Override getResponsiveConfig() to control <picture> and srcset behaviour:
See Conversion Presets for the full reference.
Built-in Preset
SocialImageConversion ships with ChambreNoir, producing og (1200x630) and twitter (1200x600) crops at 90% quality.
HasRetouchMedia Trait
Add to any Eloquent model (or Atelier block) to access rendering helpers. Ensure the field is cast to array.
Rendering Methods
URL Access
Srcset Attributes (Manual)
Returns srcset="..." sizes="..." src="..." attributes for manual <img> construction.
Graceful Degradation
All methods handle missing conversions, legacy string paths, and null data without throwing exceptions. getPicture() falls back to a simple <img>, getSrcset() returns an empty string, and getImageWithSrcset() falls back to the original URL.
See Responsive Images for detailed usage.
Attribution
ChambreNoir stores photographer credit and portfolio link alongside image data.
Enable in Form
This adds "Credit" and "Portfolio Link" fields below the upload component.
Requirement Control
Display in Templates
Attribution Methods
Gallery System
ChambreNoir ships a full gallery management system built on top of three additional tables. Galleries are managed through a dedicated Filament resource, attached to any Eloquent model via a polymorphic pivot, and rendered on the frontend via either raw Blade helpers or the included Atelier block.
Migrations
This creates galleries, gallery_images, and galleryables tables.
Add the Relationship to Your Model
GalleryPickerField writes to a polymorphic galleryables pivot. Add the relationship to any model that will hold gallery attachments:
Attach Galleries in a Form
By default only active (published) galleries are shown. Options:
Render in Blade
Atelier Block
If Atelier is installed, a GalleriesBlock is registered automatically. It supports grid and carousel display, combined or tabbed multi-gallery modes, and an optional lightbox — all driven by Alpine.js with no additional dependencies.
See Gallery System for the full reference.
Artisan Commands
Make Conversion
Generates app/BlackpigCreatif/ChambreNoir/Conversions/ProductImageConversion.php extending BaseConversion with a scaffolded define() method and responsive config.
Regenerate Conversions
Regenerate image conversions across models, Atelier blocks, and Sceau SEO data:
Configuration
Published to config/chambre-noir.php.
| Key | Default | Description |
|---|---|---|
quality |
90 |
Global default quality (1-100). Override per-preset or per-conversion. |
disk |
'public' |
Default storage disk. |
conversions_directory |
'conversions' |
Subdirectory for conversion files within the upload directory. |
presets |
[...] |
Legacy array-based presets. Use BaseConversion classes instead. |
responsive.default_conversion |
'medium' |
Fallback conversion for <img src=""> in responsive elements. |
responsive.default_sizes |
null |
Default sizes attribute. null = auto-generate from widths. |
responsive.auto_generate_sizes |
true |
Auto-calculate sizes from conversion widths and breakpoints. |
responsive.breakpoints |
Tailwind defaults | Breakpoints for auto-generated media queries. |
Environment variables:
File Storage Structure
Integration with Atelier
ChambreNoir is designed as a companion to Atelier. Use RetouchMediaUpload in block schemas and HasRetouchMedia on blocks:
In block templates:
Image cleanup for block attributes is handled automatically by Atelier's BlockManager via ImageCleanupService.
Integration with Sceau
ChambreNoir's regeneration command supports Sceau SEO images. Use --seo to regenerate Open Graph and social sharing images managed by Sceau.
License
MIT. See LICENSE.md.
Credits
All versions of chambre-noir with dependencies
filament/filament Version ^5.0
illuminate/contracts Version ^12.0|^13.0
intervention/image Version ^3.0
spatie/laravel-package-tools Version ^1.16|^2.0
spatie/laravel-translatable Version ^6.0