[OzzModz]/[Kirby] Convert uploaded PNG images to JPEG

[OzzModz]/[Kirby] Convert uploaded PNG images to JPEG 2.0.0

No permission to download

Ozzy47

Well-known member
Ozzy47 submitted a new resource:

[OzzModz]/[Kirby] Convert uploaded PNG images to JPEG - Convert PNG to JPEG

Small addon that will convert PNG images to JPEG if they are larger than the maximum allowed attachment filesize.

Please note that transparency will be lost in this case.
I did implement code to detect transparency and ignore the file if it does contain transparency, but that quite simply does not make much sense to me so the code to do this is commented out:
If the image filesize is larger than allowed maximum and it is not being converted to JPEG, the upload would fail.

Originally...

Read more about this resource...
 

vintage

New member
I'm a beginner at this stuff... I notice some differences in the php that seem fine.
But my novice question...
But what is with all the additional hashes in the json file? Are these a necessary addition?
 

vintage

New member
OK, I'm having trouble getting this to work.
I put a large jpg on my screen, and then I screen captured it as a PNG. The result was a 1.99MB png.
I then inserted that into a post and it was converted, but failed with a file too large error. So I increased my attachment size limit several times... and eventually got it to convert and upload. The end result of the post was a 1.86 MB png. PNG!
I have my attachment dimensions max set to 1024 x 800.
So it appears that the picture is being resized, but not converted to jpg?

Again, I am a novice. The add on is installed and enabled... is there another setting for it somewhere?

edit: I should note: I used the insert image button to upload the original PNG. I did not copy and paste into the text field. Does that matter? I would want the conversion to happen either way, or as an attachment. Which ever way the PNG is uploaded, I'd expect the same result.
 
Last edited:

Akomix

New member
I'd like to report having somewhat of the same issue.
I have my dimensions in the ACP set to 1200 x 1200. I've tested various file size limits and the png upload fails on each attempt due to file size.

Is there other criteria it's looking at (such as image dimensions) or is it solely looking at PNG and File Size limit (my PHP is a little rusty, but looking at the upload.php it seems to be PNG and maxfilesize)? Do we need to select a different image processor?
 

vintage

New member
I'd like to report having somewhat of the same issue.
I have my dimensions in the ACP set to 1200 x 1200. I've tested various file size limits and the png upload fails on each attempt due to file size.

Is there other criteria it's looking at (such as image dimensions) or is it solely looking at PNG and File Size limit (my PHP is a little rusty, but looking at the upload.php it seems to be PNG and maxfilesize)? Do we need to select a different image processor?
Sounds like the same issue. I suspect if you increase the file size limit you will find you do get a dimensionally reduced (px x px) image, but that it is still a PNG, and this very large. Please consider trying that... just temporarily change the file size limit to be bigger than the original file so that file size isn't a problem. And then report back what the uploaded file becomes... jpg or png?
 

Ozzy47

Well-known member
OK, I'm having trouble getting this to work.
I put a large jpg on my screen, and then I screen captured it as a PNG. The result was a 1.99MB png.
I then inserted that into a post and it was converted, but failed with a file too large error. So I increased my attachment size limit several times... and eventually got it to convert and upload. The end result of the post was a 1.86 MB png. PNG!
I have my attachment dimensions max set to 1024 x 800.
So it appears that the picture is being resized, but not converted to jpg?

Again, I am a novice. The add on is installed and enabled... is there another setting for it somewhere?

edit: I should note: I used the insert image button to upload the original PNG. I did not copy and paste into the text field. Does that matter? I would want the conversion to happen either way, or as an attachment. Which ever way the PNG is uploaded, I'd expect the same result.

I'd like to report having somewhat of the same issue.
I have my dimensions in the ACP set to 1200 x 1200. I've tested various file size limits and the png upload fails on each attempt due to file size.

Is there other criteria it's looking at (such as image dimensions) or is it solely looking at PNG and File Size limit (my PHP is a little rusty, but looking at the upload.php it seems to be PNG and maxfilesize)? Do we need to select a different image processor?

Should be fixed in 2.0.0
 

Chromaniac

Well-known member
It did work for me after the update. Now I want for the day when XF would support WebP and this addon can switch to WebP from JPG because JPG is not really suitable for all sorts of images so you might actually end up with larger images in some cases. WebP (AVIF eventually) should take care of that!
 

Chromaniac

Well-known member
i had a major feature request for this. might qualify to become a separate addon. even paid. use google's squoosh-cli for compression. it is in quite early development stage but the web client performance is amazing as i have been using it manually.


i understand that there is an existing addon that uses older compression tools to compress images but it is more of a suite that can handle existing attachments as well. something like this addon that works on fresh uploads and process them using squoosh would be quite lovely. cheers!
 
Top