[TH] Image Optimizer [Deleted]

We've just sent 1.1.0 Beta 1 to our beta team with the following features:
  • Support for ReSmush.it (Free API for images less than 5mb)
  • Support for pngquant (Open source PNG lossy optimizer -- requires pngquant to be installed on your server, and for exec to be available)
  • Support for jpegoptim (Open source PNG lossy optimizer -- requires jpegoptim to be installed on your server, and for exec to be available)
  • List of image optimizer images with the original size, new size and savings (screenshot below)
Hoping to get Beta 2 to them tomorrow containing the last couple features needed for release :)

View attachment 191802

Great news... Are you planning a resmush.it fallback for files > X Mb (manual input value in options) using local optimizers?
That would be great!
 
Great news... Are you planning a resmush.it fallback for files > X Mb (manual input value in options) using local optimizers?

Yeah, you can setup as many of the available providers as you want, can configure the allowed file types for each one and it'll run through to find the one to use. For Resmush there is a special additional check for filesize to make sure it's under that 5MB mark, if it's too big it'll move onto the next in line
 
Why not fallback to local optimizers if available?

Those are included in the available providers, if you have them (currently pngquant and jpegoptim) installed you can just set their priority to a higher value (Priority 1 runs before priority 100, for example) than ReSmush and it'll fall back to whichever is appropriate depending on the file type :)
 
The idea is if file > 5mb them just optimize it locally and don't send it to resmush.it.

Hope I understand it right
 
Those are included in the available providers, if you have them (currently pngquant and jpegoptim) installed you can just set their priority to a higher value (Priority 1 runs before priority 100, for example) than ReSmush and it'll fall back to whichever is appropriate depending on the file type :)
The idea is if file > 5mb them just optimize it locally and don't send it to resmush.it.

Hope I understand it right
I'd be curious also if file size is part of the criteria, besides file type, to determine whether a provider should even be attempted. There's no point in the overhead of even trying to send a file to resmush if it's too large.
 
The idea is if file > 5mb them just optimize it locally and don't send it to resmush.it.

Hope I understand it right

I'd be curious also if file size is part of the criteria, besides file type, to determine whether a provider should even be attempted. There's no point in the overhead of even trying to send a file to resmush if it's too large.

This isn't a configurable option that you can set in the provider options, but it is a specific check we have before even attempting to use Resmush, so no request is created to resmush if the file is over that limit
 
If all I want is for images uploaded from high-megapixel cellphones to be reduced from one million by one million, down to a management 1024x768 with corresponding smaller file size, then do I still need any of these external plans such as kraken or smushit?
 
If all I want is for images uploaded from high-megapixel cellphones to be reduced from one million by one million, down to a management 1024x768 with corresponding smaller file size, then do I still need any of these external plans such as kraken or smushit?

This addon won’t change the pixel count of images. I do believe XenForo has an option for this though, I’ll have to double check
 
This addon won’t change the pixel count of images. I do believe XenForo has an option for this though, I’ll have to double check

Xenforo does have a built in image resizer but it only works up to a certain size.
Any pics larger than that and it says "image too large".
Which would be half the pics that my phone takes. ugh
I thought that's what this add-on did. Was take care of those "too large" images.
 
Xenforo does have a built in image resizer but it only works up to a certain size.
Any pics larger than that and it says "image too large".
Which would be half the pics that my phone takes. ugh

You can adjust the maximum number of pixels in the image for that using a config.php value: https://xenforo.com/community/threads/no-album-thumbnails.149290/#post-1262982

I thought that's what this add-on did. Was take care of those "too large" images.

This add-on runs after all of the default resizing happens and just does additional optimizations to further reduce the image size (often substantially) which will speed up loading times for pages with a lot of images
 
It would be nice if this add-on could help with this.

You can adjust the maximum number of pixels in the image for that using a config.php value: https://xenforo.com/community/threads/no-album-thumbnails.149290/#post-1262982



This add-on runs after all of the default resizing happens and just does additional optimizations to further reduce the image size (often substantially) which will speed up loading times for pages with a lot of images

Thanks, Jake. But that doesn't work for me. :(
My current config.php is set to 5000000000 for max image size.

And I can't even upload an image that is 3.14 MB and 4128x3096.

"The uploaded file is too large for the server to process."

Code:
<?php

$config['db']['host'] = 'localhost';
$config['db']['port'] = '3306';
$config['db']['username'] = 'root';
$config['db']['password'] = 'xxxxxx;
$config['db']['dbname'] = 'xenforo';

$config['fullUnicode'] = true;
$config['enableTfa'] = false;

$config['maxImageResizePixelCount'] = 5000000000;

192525
 
Last edited:
Thanks, Jake. But that doesn't work for me. :(
My current config.php is set to 5000000000 for max image size.

And I can't even upload an image that is 3.14 MB and 4128x3096.

"The uploaded file is too large for the server to process."

Check the upload_max_filesize value in your php.ini, that's probably the limit you're hitting if that's the case, probably a good idea to edit out the password in your config.php contents as well
 
Holy... thanks for the heads up on the password. I didn't even notice it was there!!!!!!!!!!!

I didn't think XF2 had a php.ini, I'll look for it.
 
Check the upload_max_filesize value in your php.ini, that's probably the limit you're hitting if that's the case, probably a good idea to edit out the password in your config.php contents as well

ugh, found it in /etc/php.ini and it was already set to 5MB.
I set it to 7MB and still can't upload my test picture.

Code:
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 7M
 
found it in /etc/php.ini
Are you sure that's the one your XF install is using? If you visit /admin.php?tools/phpinfo then you should be able to confirm if that is the php.ini file that your install is using.

You could also try putting the settings at the top of your /src/config.php file.
Code:
ini_set("post_max_size", "100M");
ini_set("upload_max_filesize", "10M");
 
Ahh, wrong php.ini.
What you have to do is go to www.name.com/admin.php?tools/phpinfo
There, it'll tell you the location of your php.ini.
It was somewhere I was not expecting.
I'm all good now. :)
Sorry for taking over your thread.
Now that my users can upload large pics, I need your add-on more than ever.
Bring on the new beta download!!!!!! :D

Ahh, yes your post beat me with the same solution. hahah
 
HI @Jake B.

Can you add an option to resize images larger that W x H if admins choose to do so?
Should be good to have an option to let members upload big images but behind the scenes force the image W x H and optimize it after that.

Thanks
 
Top Bottom