We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Now I use the tinify-ruby script to compress our images. And I process 160 images that need almost nine minutes. This is my code:
@@index = 0 @@api_keys = [] def self.tinify(file_path) if @@api_keys.length == 0 UI.message("no api keys found") return end Tinify.key = @@api_keys[@@index] UI.message("current api key is: #{Tinify.key}") file_name = File.basename file_path UI.message("#{file_name} start to ready compress image") begin source = Tinify.from_file file_path source.to_file file_path UI.message("#{file_name} compress success!") @@index += 1 if @@index == @@api_keys.length @@index = 0 end rescue Tinify::AccountError => e @@index += 1 if @@index == @@api_keys.length @@index = 0 end tinify file_path rescue => e UI.message("#{file_name} compress failure!") @@index += 1 if @@index == @@api_keys.length @@index = 0 end end end
how can I optimize the process time?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Now I use the tinify-ruby script to compress our images. And I process 160 images that need almost nine minutes. This is my code:
how can I optimize the process time?
The text was updated successfully, but these errors were encountered: