Compress imagem to database laravel

"Hello, I'm developing a project in Laravel where the user can upload their own images, and I want them to be compressed when selected. Can anyone help me figure out the best way to do this?"
8 Replies
Jochem
Jochem10mo ago
if you want to do it yourself, probably convert in an exec call. It's part of imagemagick otherwise, there's services online that compress images for you but I doubt they're free past a certain point and I have no experience with them
ἔρως
ἔρως10mo ago
tinypng has a decent api you can also just implement it yourself
Jochem
Jochem10mo ago
ffmpeg does images too if you're a bit of a masochist
ἔρως
ἔρως10mo ago
you probably wont do stuff like quantizing png images, but reading and saving a png to webp is just a few function calls in php if you wanna do it manually, just use squoosh.app if you are using wordpress with bedrock, wordpress has it built-in ffmpeg is very powerful, but super hard
DoContra
DoContraOP10mo ago
That sounds interesting, how can I do that?
ἔρως
ἔρως10mo ago
just read the php docs on images its a list of functiond functions you will get it easily
Joao
Joao10mo ago
I would recommend Intervention Image: https://image.intervention.io/v3
Intervention Image | Intervention Image v3 | intervention.io
Intervention Image provides an easy way to manipulate images with PHP using the GD or Imagick library.
ἔρως
ἔρως10mo ago
back in my day, we used WideImage that seems to have a pretty good api
Want results from more Discord servers?
Add your server