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
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 themtinypng has a decent api
you can also just implement it yourself
ffmpeg does images too if you're a bit of a masochist
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
That sounds interesting, how can I do that?
just read the php docs on images
its a list of functiond
functions
you will get it easily
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.
back in my day, we used WideImage
that seems to have a pretty good api