GithubHelp home page GithubHelp logo

niladam / wp-cli-kraken Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tillkruss/wp-cli-kraken

0.0 2.0 0.0 11 KB

WP-CLI command to optimize WordPress image attachments using the Kraken Image Optimizer.

License: MIT License

PHP 100.00%

wp-cli-kraken's Introduction

WP CLI Kraken

WP-CLI command to optimize/compress WordPress image attachments using the Kraken Image Optimizer API.

Synopsis

wp media krake [<attachment-id>...] [--lossy] [--all] [--dry-run]
[--limit=<number>] [--types=<types>] [--compare=<method>]
[--api-key=<key>] [--api-secret=<secret>] [--api-test]

For more details type:

wp help media krake

Installing

  1. Install WP-CLI.
  2. Install WP-CLI-Kraken via Composer, or WP-CLI's --require attribute.
  3. Define Kraken API credentials. See Setup.

Setup

To get started, define the Kraken API credentials in the wp-cli.yml:

kraken:
	api-key: <your-api-key>
	api-secret: <your-api-secret>

Then validate the API credentials by running:

wp media krake --api-test

Or alternatively, pass the Kraken API credentials via the --api-key and --api-secret flags:

wp media krake --api-test --api-key=<key> --api-secret=<secret>

Configuration

The following configuration values can be defined in YAML config files.

kraken:
	api-key: <your-api-key>				Kraken API key.
	api-secret: <your-api-secret>		Kraken API secret.
	lossy: <bool>						Use lossy image compression. Default: Use lossless compression.
	compare: <method>					Image metadata comparison method. Available methods: `none, md4, timestamp`. Default: `md4`.
	types: <type(s)>					Image format(s) to krake. Available types: `gif, jpeg, png, svg`. Default: `gif,jpeg,png,svg`.

Command Examples

# Krake all images that have not been kraked.
wp media krake

# Krake all image sizes of attachment with id 1337.
wp media krake 1337

# Krake images using lossy compression.
wp media krake --lossy

# Krake a maximum of 42 images.
wp media krake --limit=42

# Krake only PNG and JPEG images.
wp media krake --types='png, jpeg'

# Use file modification time for metadata comparison.
wp media krake --compare=timestamp

# Krake all images, bypass metadata comparison.
wp media krake --all

# Do a dry run and show report without executing API calls.
wp media krake --dry-run

# Validate Kraken API credentials and show account summary.
wp media krake --api-test

wp-cli-kraken's People

Contributors

danielbachhuber avatar tillkruss avatar

Watchers

James Cloos avatar Madalin Tache avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.