© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
trovster

Image Editor Height/Width

I want to create an image which is a specific size. I defined height (400) and width (270) constants that I am using and I have built the
FileUpload
FileUpload
component like the following. However, after using the image editor, it crops the image incorrectly. It creates an image a few pixels smaller than required! How can I create an image with the exact sizes I want.

FileUpload::make('poster')
  ->panelAspectRatio($this->aspectRatio())
  ->imageCropAspectRatio($this->aspectRatio())
  ->imagePreviewHeight((string) Movie::POSTER_HEIGHT)
  ->imageResizeTargetHeight((string) Movie::POSTER_HEIGHT)
  ->imageResizeTargetWidth((string) Movie::POSTER_WIDTH)
  ->image()
  ->imageEditor()
  ->imageEditorAspectRatios([
      $this->aspectRatio(),
  ]);

protected function aspectRatio(): string
{
    return Movie::POSTER_WIDTH . ':' . Movie::POSTER_HEIGHT;
}
FileUpload::make('poster')
  ->panelAspectRatio($this->aspectRatio())
  ->imageCropAspectRatio($this->aspectRatio())
  ->imagePreviewHeight((string) Movie::POSTER_HEIGHT)
  ->imageResizeTargetHeight((string) Movie::POSTER_HEIGHT)
  ->imageResizeTargetWidth((string) Movie::POSTER_WIDTH)
  ->image()
  ->imageEditor()
  ->imageEditorAspectRatios([
      $this->aspectRatio(),
  ]);

protected function aspectRatio(): string
{
    return Movie::POSTER_WIDTH . ':' . Movie::POSTER_HEIGHT;
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Image Editor width
FilamentFFilament / ❓┊help
5mo ago
Uploading image save width and height
FilamentFFilament / ❓┊help
3y ago
Image min and max width and height
FilamentFFilament / ❓┊help
3y ago
FileUpload Preview (Image Height/Width or Zoom) possible?
FilamentFFilament / ❓┊help
10mo ago