Skip to main content
Topic: [ADDON] Resize attached images (Read 26916 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: [ADDON] Resize attached images

Reply #60

Can't answer to your question, just a note, don't use a 60% quality, it's too low as quality, you will notice the differences. I'd suggest you to use something about 80-85%, a normal jpg file resized to 1024 X 768 at 80% will be about 100-120 kb, which is already a  good result. 
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #61

Yes, I don´t want the attachments bigger than 100 Kbytes each...

Re: [ADDON] Resize attached images

Reply #62

Can this plugin be updated , that it also resizes and reduces the filesize for already uploaded pictures ?


Re: [ADDON] Resize attached images

Reply #64

Still using this add-on and running well, I have a suggestion for it:
My users are posting screenshots from phones, and most of them are .png files, which are taking more space than a .jpg file.
Here an example:
- the png file 909 Kb
- the jpg file I converted on my PC is only 172 Kb (converted with command "mogrify -format jpg *.png")
Since it's an image without transparency imho it has no sense to be saved as PNG. What I suggest, obviously if it's possible: if the png file does not contain transparency then save it as JPG, if has transparency leave it as PNG.


Re: [ADDON] Resize attached images

Reply #65

Isn't that the Allow non-JPEG images to be reformatted to JPEG format when resizing setting?

Re: [ADDON] Resize attached images

Reply #66

Allow non-JPEG images to be reformatted to JPEG format when resizing.
 Selecting this option will allow the system to reformat non-JPEG images into the JPEG format when necessary. The system will try to maintain the existing format unless the resulting image is still in excess of the maximum file size allowed.


I just checked, I have that enabled, but is useless in my case because I have set high values for:
Max attachment size per post 9600 KB
Max size per attachment 5000 KB
Max number of attachments per post 15
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #67

Quote from: radu81 – Allow non-JPEG images to be reformatted to JPEG format when resizing.
 Selecting this option will allow the system to reformat non-JPEG images into the JPEG format when necessary. The system will try to maintain the existing format unless the resulting image is still in excess of the maximum file size allowed.


I just checked, I have that enabled, but is useless in my case because I have set high values for:
Max attachment size per post 9600 KB
Max size per attachment 5000 KB
Max number of attachments per post 15
So I'm assuming that the addon was triggered by WxH image pixel size limits?  I like the idea of checking alpha channel info but would likely need another ACP option since right now it did what you specified (e.g. it falls within the constraints you set)

Re: [ADDON] Resize attached images

Reply #68

Here is something to test .... for 1.1 only .... Replace your existing file with this one (keep the old one safe in case you need to back out)

This will identify non transparent PNG files and if you have the checkbox to allow format conversion enabled, then it will change those non transparent PNG to a JPG (assuming the PNG was to big WxH or KB)

Sadly the only way to check for transparency is to examine every pixel in an image to see if it any have alpha value < 1.  This indicates that it has some level of transparency.  You can't simply trust how the file was saved (simple header read) since you can save a PNG that has no transparency with the transparency flag, thats just the way things work.

Should work with either GD or Imagick

Re: [ADDON] Resize attached images

Reply #69

Thanks for your support Spuds! This seem to work fine on my forum:
- uploaded PNG screenshot from mobile without transparency (BMW car), the image is saved as jpg (900 Kb in PNG -> 97 Kb in jpg format, size 1200 x 900). This is great, I just saved 0,8 MB with only 1 png image!  8)
- uploaded a small PNG file with transparency, the file was saved correctly as png with transparency (400 x 335 px, 30,9 KB -> same size, same dimension)
- uploaded a big PNG file with transparency (3500 × 2284 px, 982 KB -> saved as PNG with transparency 1200 x 783 px, 281 KB)

I only tested with Imagick. Thanks again!
Last Edit: September 24, 2020, 11:01:49 am by radu81
sorry for my bad english

Re: [ADDON] Resize attached images

Reply #70

Cool, thanks for testing.  I'll pack this up and update the addon soon-ish

Re: [ADDON] Resize attached images

Reply #71

Will there be an update of this addon for the version ElkArte 1.1.7

Re: [ADDON] Resize attached images

Reply #72

nothing to report for now, it works with 1.1.7
sorry for my bad english

 

Re: [ADDON] Resize attached images

Reply #73

Minor update to version 1.0.7

  • Adds support for ElkArte 1.1.9, specifically support for conversion to WEBP if that option is enabled in the Admin Panel
  • Improves transparency detection performance on large images
  • Tested on php 8.1 / Elk 1.1.9

To get the addon you can do one of two things:
  • You can download the file from the Addons site and then upload that file to your server
    • Admin > Packages > Upload > Select the zip file you just downloaded > Upload
  • Or Download it directly to your site
    • Admin > Packages > Download Package > click "Browse" by "ElkArte Third-party Add-ons Site" > expand Utility > Attachment Image Resizing > Download
   
Last Edit: November 06, 2022, 10:57:57 am by Spuds