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.
Automatically compress images
Automatically compress images
- Attachments
-
- serendipity_event_tinypng-0.1.tar.gz
- (148.72 KiB) Downloaded 3412 times
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Automatically compress images
I'll try to test this soon. You mentioned existing images would not be touched. Could that be an option?
=Don=
Re: Automatically compress images
It could be something on adds later. Currently it can't work well, you only have 500 free API-calls per month.
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Automatically compress images
Who only has 500 free API calls per month?onli wrote:It could be something on adds later. Currently it can't work well, you only have 500 free API-calls per month.
=Don=
Re: Automatically compress images
The developer API for the TinyPNG web interface.Don Chambers wrote:Who only has 500 free API calls per month?
I assume every plugin user will have to get their own API key, otherwise it doesn't really make sense (to me).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.
YL
Re: Automatically compress images
Yes. The description of the API Key option explains where to get the key. Without it won't work.yellowled wrote:I assume every plugin user will have to get their own API key, otherwise it doesn't really make sense (to me).
Re: Automatically compress images
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
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
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.
I will have a look whether the Tinyfy-Client really needs it, but that is possible.
Re: Automatically compress images
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.
It seems that the API of TinyPNG has counted my tries with the error, too.
Re: Automatically compress images
I now pushed this to Spartacus: https://github.com/s9y/additional_plugi ... d6009e55f2