Weave Code
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
Sonata Media Fixed Dimensions Resizer

Sonata Media Fixed Dimensions Resizer Laravel Package

aivus/sonata-media-fixed-dimensions-resizer

View on GitHub
Deep Wiki
Context7

Sonata Media Bundle Resizer with fixed aspect ratio

Frequently asked questions about Sonata Media Fixed Dimensions Resizer
Does this package work with Laravel 9/10 or only Symfony?
This package is Symfony-centric and lacks Laravel-specific optimizations. While it may work in Laravel apps using SonataMediaBundle, you’ll need to manually bridge Symfony components like EventDispatcher or Filesystem. No official Laravel 9/10 support exists, and the last update predates modern PHP versions.
How do I install this in a Laravel project using SonataMediaBundle?
Add it via Composer with `composer require aivus/sonata-media-fixed-dimensions-resizer`, then configure SonataMediaBundle’s `sonata_media.yaml` to use the custom resizers (`inset` or `outbound`). Ensure SonataMediaBundle v2.x is installed, as v3.x compatibility is untested. No Laravel-specific setup steps are documented.
Can I use this for dynamic aspect ratios (e.g., user-uploaded images with varying dimensions)?
No, this package enforces fixed dimensions (e.g., 120x120) and doesn’t support dynamic adjustments. For variable aspect ratios, consider alternatives like Intervention Image or Spatie’s Laravel Media Library, which offer flexible resizing logic.
Will this break if SonataMediaBundle updates its API?
High risk—this package is abandoned and hasn’t been tested against SonataMediaBundle updates since 2018. If SonataMediaBundle changes its resizer interface, this package may fail silently. Monitor the SonataMediaBundle changelog and prepare to fork or replace it if needed.
How do I handle resized images in Laravel’s filesystem or queues?
The package uses Symfony’s Filesystem, so Laravel’s native storage (e.g., `public`, `s3`) won’t integrate seamlessly. For queues, you’d need to manually wrap the resizer in a Laravel job and dispatch it after uploads. No built-in support exists for async processing.
Are there alternatives for fixed aspect ratio resizing in Laravel?
Yes—consider **Intervention Image** (lightweight, Laravel-friendly) or **Spatie’s Laravel Media Library** (feature-rich, supports aspect ratios natively). Both avoid Symfony dependencies and are actively maintained. For Symfony-heavy Laravel apps, this package *might* suffice if you’re already using SonataMediaBundle.
Does this package support caching resized images to avoid reprocessing?
No caching mechanism is documented. Repeated resizing of the same image will reprocess it every time, increasing load. For production, implement a custom cache (e.g., Redis or filesystem hashing) or use Laravel’s `cache()->remember()` around the resizer.
How do I test resizing accuracy (e.g., aspect ratio preservation)?
Manually verify outputs by comparing resized images to expected dimensions (e.g., 726x380 → 120x63 for `inset`). Use PHPUnit to assert file sizes/extensions post-resize. No test suite or assertions are provided in the package.
Can I extend this for custom resizing logic (e.g., progressive JPEG, WebP conversion)?
No—this package is hardcoded to two resizer types (`inset`/`outbound`) with no hooks for extensions. To add features like format conversion, you’d need to fork the package or wrap it in a custom service class.
Is this safe for production with user-uploaded images?
Potential risks include path traversal if output paths aren’t sanitized and memory issues with large files (synchronous processing). No input validation or security audits are documented. For production, validate dimensions, use Laravel’s `Storage` facade, and consider rate-limiting uploads.
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.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium