Hi Xaver,
Thanks for writing!
No, at the moment there is not a simple method you can call with only the attachment id to compress images. Interestingly, another user just recently opened the same feature request on the Github repository: https://github.com/tinify/wordpress-plugin/issues/21
As you can also read there, you could for the time being use the compress() function of Tiny_Image. In order to call that, you first need to create a Tiny_Image instance by passing along a few arguments. You can find examples on how it’s being used within the plugin in class-tiny-plugin.php.
I hope that helps you!
Thread Starter
Xaver
(@xaverb)
Thanks! I’m looking forward to see this added.
Create plugin/service!