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 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;
}
Was this page helpful?