Uploading file and setting max width/auto height

Hey all, hoping someone can help. I have the following code:
Forms\Components\FileUpload::make('image')
->directory('cms')
->image()
->imageEditor()
->imageEditorAspectRatios([
null,
'16:9',
'9:16',
'4:3',
'3:4',
'1:1',
])
->imageResizeMode('contain')
->imageResizeTargetWidth('1288')
Forms\Components\FileUpload::make('image')
->directory('cms')
->image()
->imageEditor()
->imageEditorAspectRatios([
null,
'16:9',
'9:16',
'4:3',
'3:4',
'1:1',
])
->imageResizeMode('contain')
->imageResizeTargetWidth('1288')
I am trying to upload an image and reduce and images that are too large to max 1288px width, whilst keeping the height dynamic. However, the above code stretches a smaller image to hit 1288px width. How can i stop it stretching the image and only reduce the size if too big? Thanks
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?