PHP : Compress Images (Lossly?)

one text

I made a website where visitors can upload Images (Jpg, Jpeg , PNG) from that particular event. I used the move_uploaded_file() and imagerotate() function to move it correctly to an other directory.

But there is another problem on this moment. I use the function imageJpeg to reduce the imagesize and i use 80%. Still it isn't enough to reduce the imagesize when they upload an image from 20MB or more with their phone. I still get images from 5-7MB and that's to mutch.

I'm searching for an solution to compress this images. And not with the imagejpeg function because it isn't lossly and i want to use the pictures after the event with a good quality. Is there a possibility to do this in PHP?

Thank you in advance. Best regards.

Source