tinify/tinify-php

Request: Method for check month usage

pedroloureiro82 opened this issue · 6 comments

It would be useful a new feature for checking our month usage via API

Yes! It is actually already possible. You can use:

\Tinify\getCompressionCount();

Thanks for reporting though, we should add this to the documentation!

This method only works when you shrink an image:

method: POST
url: api.tinify.com/shrink

So, i think you should create a new URI (eg. /getCompressionCount) which returns the current value.

That's right, you need to compress first to get your compression count. We might add a method in the future that can do it without compressing.

@rolftimmermans this issue should be reopened.

You can do the following if you don't want to compress an image:

\Tinify\setKey(/* ... */);
\Tinify\validate();
\Tinify\getCompressionCount();

We appreciate that another endpoint might be useful, but prefer not to keep track of feature requests across our API client projects. Hopefully this workaround is sufficient for you. If we add new features to our API we will update the official clients accordingly!

thanks 👍