How do we compress a jpg without changing dimensions |
3/16/2024 7:47:23 AM |
PHPRunner General questions | |
P
pmuckle authorDevClub member
Hi All, I wondered how to compress an uploaded jpg without changing the dimensions or losing image quality? Thanks for any advice Pete |
|
D
|
DRCR Dev 3/16/2024 |
If you want to use PHPRUNNER, I would change the dimensions but have the webpage show a higher dimension. |
![]() |
HJB 3/16/2024 |
https://www.jclabs.co.uk/generate-webp-images-in-php-using-and-gd-or-imagick/ PHP script to convert PNG, JPG and GIF to much smaller WEBP format. |
P
|
pmuckle authorDevClub member 3/16/2024 |
Thanks, that code looks fairly easy to understand. I use tinypng which has reduced my png files by 64% ie 43 kb -> 16 kb. I'd like to keep the original png or jpg format - is that possible using that script? It would be great to have this type of facility built-in to the image upload options tab of phprunner. |
![]() |
fhumanes 3/17/2024 |
HI, The Best Way to Compress JPG Files with ImageMagick I have an example of Imagick's use in a Phprunner project. https://fhumanes.com/blog/guias-desarrollo/guia-63-convertir-pdf-a-png/ With this Imagick library you can perform wonders with the images. Greetings, |
P
|
pmuckle authorDevClub member 3/18/2024 |
Thank you Fernando, that looks very useful. I'll see if I can work out how to code it to compress images Regards |
![]() |
HJB 3/18/2024 |
My post was a SERVER-SIDE oriented one where many users are e.g. uploading photos. Example: You have e.g. 20 pictures in your page. So, the server would need to run 20 requests Accordingly, the content of this thread is likely more a worldwide community related one rather I only came across that recently after having been purchasing a web design tool where BOTH |
P
|
pmuckle authorDevClub member 3/18/2024 |
That's interesting, thanks. I have used base64 for making standalone html files with images. It does increase size by around 30%. |
![]() |
HJB 3/18/2024 |
@Pumuckl As I tried to explain, we have to differ between COMPRESSED image files BEFORE upload into the web By yesterday, I looked around on how PHP 8.3 is performing towards the elder versions. It was mentioned Quint-Essence: Whether or not to compress/base64 something on the UPLOAD side, does not really once P.S. When you look how AI upload files are handled, you are about to discover that BEFORE your file is Sure, if the ordinary web page publisher is more than happy to own 30 visits PER DAY or so, all the above, |