Karina Image Optimizer

Description

Karina Image Optimizer (formerly Imagepress) optimizes every image you upload before WordPress creates any thumbnails. You choose the output:

  • Keep the original format (default): a JPEG stays a JPEG and a PNG stays a PNG, with the same file name and URL, just smaller. Compression is lossless first.
  • Convert to WebP: every image becomes an optimized .webp file, usually the smallest result.

  • Automatic: JPEG, PNG, BMP and WebP uploads (and GIF, if you enable it) are optimized as you upload them. This works in the Media Library, the block editor, media_sideload_image() and WP-CLI.

  • Clean: the original file is replaced. Every thumbnail size is generated from the optimized version, so no unoptimized copies are left on your server.
  • Safe: if the API is unreachable, slow or returns an error, the upload continues with the original image. Uploads never break.
  • Smart: files are kept as they are when the optimized version would not be smaller (optional), and animated GIF/WebP files are never converted to WebP.
  • Existing images too: a background queue optimizes images uploaded before Karina Image Optimizer was active. You can pause, resume and cancel it, and it keeps running via WP-Cron when you close the page. In WebP mode, links in your posts are updated and old file URLs redirect to the new files.
  • Native: a settings screen under Settings Karina Image Optimizer with a connection test, statistics and a server compatibility check. The Media Library list view shows the saving for each image and has an “Optimize” row action and bulk action.

Karina Image Optimizer needs an account with an image optimization API. By default it is set up for the Karina image optimization API, and you can point it at any compatible endpoint.

Languages

Karina Image Optimizer is available in English and Persian (فارسی). Translations, including Persian (fa_IR), are installed automatically from translate.wordpress.org, and the plugin is right-to-left (RTL) ready.

External services

This plugin connects to an external image optimization API to optimize your images (and, if you choose, convert them to WebP). Nothing is sent until you enter an API key on the settings screen.

  • What is sent and when: each time a user who can upload files (or WP-CLI) uploads a supported image, the image file, its file name and the requested output format (keep or WebP) are sent to the configured endpoint, along with your API key in the Authorization header and a User-Agent containing the plugin and WordPress versions. When an administrator starts optimizing existing images (or uses the “Optimize” action in the Media Library), those images are sent the same way, one request per image, in the background. The “Test connection” button sends one request that contains no image. Nothing is sent at any other time.
  • Default service: Karina image optimization API, https://karinaco.net/api/v1/image/optimize, provided by Karina.
    • Terms of service: https://karinaco.net/terms?lang=en
    • Privacy policy: https://karinaco.net/privacy?lang=en
    • Images are processed on Karina’s own servers and are not passed to third parties. The uploaded original is discarded as soon as the request ends. The optimized result is kept for about 60 minutes (so that re-sending the same image, for example after a timeout, is not charged twice) and then deleted automatically.
    • For quota, billing and support, Karina logs each request (account, API key, the requesting server’s IP address, file name, size and type, result, tokens charged and User-Agent) for 90 days. The image itself is not stored in this log.
  • If you change the endpoint, images are sent to the service you configured instead, and that service’s own terms and privacy policy apply.

Screenshots

Installation

  1. Upload the karina-image-optimizer folder to /wp-content/plugins/, or install the plugin from Plugins Add New.
  2. Activate it.
  3. Get your API key from your dashboard at karinaco.net/dashboard/tokens. If you need more tokens, buy them at karinaco.net/pricing.
  4. Go to Settings Karina Image Optimizer, enter your API key, and click Test connection.
  5. Choose the output format: keep the original format (default) or convert to WebP.
  6. Upload an image. It is stored smaller, in the format you chose.

To keep the key out of the database, define it in wp-config.php instead:

define( 'KARINA_IO_API_KEY', 'your-key' );

FAQ

I used Imagepress. What happens to my settings?

Karina Image Optimizer is the new name of Imagepress. Install and activate it, then deactivate and delete Imagepress (while Imagepress is active, Karina Image Optimizer stays idle so images are not optimized twice). Your settings, statistics, per-image results and the redirects of converted images are then moved over automatically. If you defined IMAGEPRESS_API_KEY in wp-config.php, rename it to KARINA_IO_API_KEY. A queue run of existing images that was in progress is not carried over: start it again under Settings Karina Image Optimizer.

What happens if the API is down?

The upload goes through with the original file. The error is shown under Statistics Last error on the settings screen.

Can I optimize images I uploaded before installing Karina Image Optimizer?

Yes. Go to Settings Karina Image Optimizer Existing images, choose Only featured images (of posts and/or products — the safest choice, especially when converting to WebP) or All images in the Media Library, and start, or select images in Media Library (list view) and choose Optimize with Karina Image Optimizer. They are processed one by one in the background. Errors that come from the service (wrong key, quota, outage) pause the queue rather than marking every image as failed.

  • Keep format: each image keeps its file name and URL. The full-size file is replaced by its optimized version and every thumbnail is regenerated from it.
  • Convert to WebP: each image is renamed to .webp and its old files (including the full-size original) are deleted, so back up your uploads folder first. Links in post content and excerpts are updated, and requests for an old file URL are redirected (301) to the new file whenever the request reaches WordPress. Links stored elsewhere, such as in page-builder data, rely on that redirect.

The queue is slow or stuck

The queue runs on WP-Cron, which only fires when your site gets visits. Keep the settings page open to process images continuously, or set up a real server cron job for wp-cron.php. If DISABLE_WP_CRON is set, a server cron job is required.

Why are some uploads not converted?

An upload is left unchanged when its format is not enabled, it is larger than 20 MB, or the optimized result is not smaller (when that option is on). When converting to WebP, animated files are skipped, as are all uploads if your server’s image editor cannot create WebP thumbnails (the Server check panel shows this). When keeping the format, BMP files are skipped because BMP has no compression to optimize.

Should I keep the format or convert to WebP?

WebP is usually the smallest and every current browser supports it. Keep the original format if your theme, another plugin or an external service expects JPEG/PNG files, or if you want file names and URLs to stay exactly as uploaded.

Is image metadata kept?

Usually not. The API strips EXIF/IPTC data, including camera and GPS information, as part of the optimization, and applies the EXIF orientation first so photos keep the right orientation. When the format is kept and a file is already optimal, it is returned unchanged, metadata included.

Uploads time out on my host

Uploads wait for the API. If PHP’s max_execution_time is shorter than the plugin’s timeout, lower the timeout or ask your host to raise the limit. The Server check panel warns you about this.

Developer hooks

  • karina_io_should_optimize (filter) – ( bool $should, array $upload, string $context )
  • karina_io_max_file_size (filter) – ( int $bytes )
  • karina_io_request_args (filter) – ( array $args, string $endpoint )
  • karina_io_optimized (action) – ( array $new_upload, array $original_upload )
  • karina_io_optimization_failed (action) – ( WP_Error $error, array $upload )
  • karina_io_featured_post_types (filter) – ( array $types ): post types whose featured images “Only featured images” offers (slug => label).
  • karina_io_queue_time_budget (filter) – ( int $seconds ): how long one WP-Cron run keeps starting new images (default 20).

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Karina Image Optimizer” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.4.0

  • Renamed from Imagepress to Karina Image Optimizer, for the WordPress.org plugin directory. Settings, statistics and per-image data of Imagepress are moved over automatically (see the FAQ).
  • The API key field links to karinaco.net/dashboard/tokens to get an API key and to karinaco.net/pricing to buy tokens.
  • New: when the token balance is used up or the account has no token package, the error says so (in your language), and the settings screen, the paused queue and the connection test link to the pricing page.
  • Fix: when converting existing images to WebP, the old files are now deleted only after the new thumbnails were built, so a failure can no longer leave broken image links.
  • Fix: “Test connection” no longer sends the saved API key to a different endpoint typed into the form.
  • Fix: cancelling the queue while an image is being processed no longer leaves that image marked as queued.
  • Fix: the plugin description on the Plugins screen showed garbled characters.
  • Translations, including Persian, now come as language packs from translate.wordpress.org instead of the plugin’s languages folder.

1.3.2

  • Fix: on hosts that stop PHP after 30 seconds, large images no longer fail with “Operation timed out”. Karina Image Optimizer now raises the PHP time limit while it waits for the API, so the timeout no longer has to be lowered.
  • The server check warns when the API timeout is below 60 seconds. It no longer suggests lowering the timeout.

1.3.1

  • Fix: a temporary API error (HTTP 5xx such as 502, or a timeout) no longer pauses the existing-images queue. The image is retried after 30 and then 60 seconds. An image that keeps failing is marked failed and the queue moves on. The queue pauses only when three images in a row fail, and those images are put back first.
  • New: Persian (fa_IR) translation, loaded from the plugin’s languages folder.

1.3.0

  • New: optimize only featured images (posts and/or WooCommerce products, including variations) — the new default choice for existing images. Featured images are linked by ID, so themes and WooCommerce follow a WebP conversion automatically.

1.2.0

  • New: optimize existing images with a background queue (WP-Cron plus live progress on the settings page), with pause, resume and cancel.
  • New: “Optimize” row action and “Optimize with Karina Image Optimizer” bulk action in the Media Library. The column shows queued, failed and skipped images.
  • New: when existing images are converted to WebP, links in post content are updated (setting) and old file URLs redirect to the new files.
  • Deactivating the plugin pauses the queue; uninstalling removes all queue data.
  • The API key field links to the karinaco.net sign-up page while no key is saved.

1.1.0

  • New: “Output format” setting: keep the original format (new default) or convert to WebP.
  • The Media Library column shows the output format.

1.0.0

  • First release.