gidaban79's avatar

Image manipulation

Hello guys hope you are well?

I have question about best practices / solution of upload and image manipulation. I want to add image as post image.

  1. upload original image then resize and save again?
  2. catch image, resize and save?

Which way will be better ?

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

Have a look at Spatie media library

You give it the uploaded file and it will store it and create any transformations you require. Then provide methods where you can ask for the URL or Path of a particular file size, eg thumb

Its a very mature package, now on version 9 and should handle all your needs.

https://spatie.be/docs/laravel-medialibrary/v9/introduction

Don't confuse it with Media Library Pro which is a paid for package and contains tools to actually manage the images (more like an asset manager)

1 like

Please or to participate in this conversation.