Page 1 of 1

Automatically compress images

Posted: Sun Sep 11, 2016 11:17 pm
by onli
There are some ways to compress images. JPGs lose quality, but PNGs support lossless compression. TinyPNG is one of several services that does that with sound defaults.

I made a plugin for it. It will automatically compress each image (.png or .jpg), directly after the upload. Already uploaded images won't be touched.

It would be great if this could be further tested before going to spartacus :) I also take feature requests.

Re: Automatically compress images

Posted: Thu Sep 15, 2016 5:07 am
by Don Chambers
I'll try to test this soon. You mentioned existing images would not be touched. Could that be an option?

Re: Automatically compress images

Posted: Thu Sep 15, 2016 10:08 am
by onli
It could be something on adds later. Currently it can't work well, you only have 500 free API-calls per month.

Re: Automatically compress images

Posted: Fri Sep 16, 2016 3:51 am
by Don Chambers
onli wrote:It could be something on adds later. Currently it can't work well, you only have 500 free API-calls per month.
Who only has 500 free API calls per month?

Re: Automatically compress images

Posted: Fri Sep 16, 2016 8:45 am
by yellowled
Don Chambers wrote:Who only has 500 free API calls per month?
The developer API for the TinyPNG web interface.
You only pay for what you use. The first 500 compressions each month are free. You will only be billed if you compress more than 500 images.
I assume every plugin user will have to get their own API key, otherwise it doesn't really make sense (to me).

YL

Re: Automatically compress images

Posted: Fri Sep 16, 2016 10:36 am
by onli
yellowled wrote:I assume every plugin user will have to get their own API key, otherwise it doesn't really make sense (to me).
Yes. The description of the API Key option explains where to get the key. Without it won't work.

Re: Automatically compress images

Posted: Sat Sep 17, 2016 6:36 pm
by MarioH
Hi,

I just get this error when uploading an image with the new plugin installed:

Fatal error: Call to undefined function Tinify\curl_version() in /var/www/vps.hommel-net.de/serendipity/plugins/serendipity_event_tinypng/tinify-php/lib/Tinify/Client.php on line 11

The image is in the media library after this error but it's not compressed.

Regards
Mario

Re: Automatically compress images

Posted: Sat Sep 17, 2016 7:34 pm
by onli
Is it possible that you have no php curl module active? A package like php-curl?

I will have a look whether the Tinyfy-Client really needs it, but that is possible.

Re: Automatically compress images

Posted: Sat Sep 17, 2016 8:14 pm
by MarioH
That was the thing. The debian package is php5-curl. After installing it the error is gone.
It seems that the API of TinyPNG has counted my tries with the error, too.

Re: Automatically compress images

Posted: Sun Oct 16, 2016 12:13 pm
by onli