MITS Image Optimizer

Sharraxaad

MITS Image Optimizer is a professional image optimization toolkit for WordPress. It compresses images automatically on upload, batch-converts your entire media library to WebP and AVIF, configures Apache to serve next-gen formats automatically, and scans your site for common technical SEO issues.

Features

Auto-Compress on Upload
Every JPG/PNG above a configurable size threshold is automatically scaled and compressed before WordPress generates its thumbnail sizes. No extra steps needed.

Bulk Compression
Run a background batch job to compress all existing images in your media library. Progress is tracked and the job runs asynchronously – it won’t block your browser.

WebP Converter
Batch-convert all JPG/PNG/GIF files in your uploads directory to WebP format. Runs in the background using WP-Cron or a loopback HTTP request. Supports both Imagick and GD libraries.

AVIF Converter
Convert images to AVIF – the next-generation format that can be 30–50% smaller than WebP. Requires Imagick 7+ with AVIF support or PHP 8.1+ with GD imageavif(). The plugin detects support automatically and warns you if AVIF is unavailable on your server.

Apache .htaccess Configuration
One click adds mod_rewrite rules to your .htaccess so Apache automatically serves .webp files to browsers that support them, with no code changes required in your theme.

Image Dimensions Scanner
Detects images ≥ 1600 px wide that are used in posts or as featured images. Helps you find oversized images that slow down page loads, along with their file sizes, dimensions, and WebP/AVIF conversion status.

Site Audit
Scans your site for the most common technical issues: missing alt text, oversized images, missing SSL, outdated plugins, pages without Open Graph tags, and more. Results include actionable recommendations.

Dashboard Widget
A compact stats panel on the WordPress admin dashboard showing compression savings, WebP/AVIF conversion counts, and a link to the optimizer.

Requirements

  • PHP 8.0+, WordPress 6.0+
  • GD or Imagick PHP extension (for WebP/compression)
  • Imagick 7+ with AVIF or PHP 8.1+ GD (for AVIF conversion)
  • Apache + mod_rewrite (for automatic WebP serving via .htaccess)

Developed and maintained by MITS – a Polish web agency specializing in WordPress performance and development.

Privacy

This plugin does not collect any personal data and does not make any external HTTP requests.

Sawir-shaashado

Rakibaad

  1. Upload the mits-image-optimizer folder to /wp-content/plugins/.
  2. Activate the plugin via Plugins Installed Plugins.
  3. Navigate to MITS Optimizer in the WordPress admin sidebar.
  4. (Optional) Click Konfiguruj .htaccess on the WebP tab to enable automatic browser-side WebP delivery.

SBI

Does this plugin delete my original images?

No. Original images are never deleted. WebP and AVIF files are saved alongside originals with a .webp or .avif extension (e.g. photo.jpg photo.jpg.webp).

What happens if my server doesn’t support AVIF?

The AVIF tab will display a warning with the reason (e.g. Imagick version too old, or GD imageavif() not available). WebP conversion and compression still work independently of AVIF support.

Does it work with object-cache or page-cache plugins?

Yes. The plugin only modifies image files in your uploads directory and your .htaccess. It is compatible with all major caching plugins.

Can I run compression and WebP/AVIF conversion at the same time?

It is not recommended. Run one batch job at a time to avoid server load spikes and to keep progress tracking accurate.

Is the .htaccess change reversible?

Yes. The plugin wraps its rules in clearly marked comment blocks (# BEGIN MITS WebP# END MITS WebP). You can remove them manually or via the plugin button.

What image formats are supported?

Auto-compression and bulk compression support JPG, JPEG, PNG, and GIF. WebP and AVIF conversion support the same formats. GIF files are converted to static WebP/AVIF (animation is not preserved).

Dibu-eegisyo

28 Maajo, 2026
Does exactly what it promises. Auto-compression on upload works out of the box, WebP batch conversion runs smoothly in the background without blocking the browser, and the .htaccess configuration for automatic WebP serving is a one-click setup. The Image Dimensions Scanner is a nice bonus for catching oversized images before they become a performance problem.
Akhri dhammaan 0 dibu-eegis

Ka-qaybgalayaasha & Horumariyayaasha

“MITS Image Optimizer” waa softiweer il furan. Dadka soo socda ayaa wax ku biiriyay kaabahan.

Ka-qaybgalayaasha

Ku tarjun “MITS Image Optimizer” luqaddaada.

Ma xiisaynaysaa horumarinta?

Baadh koodka, fiiri bakhaarka SVN, ama iska qor diiwaanka horumarinta adigoo adeegsanaya RSS.

Isbeddellada

1.2.55

  • Fix: Replace em dashes with regular hyphens in all user-visible text and comments.

1.2.54

  • Feature: When Nginx config write fails (no root permissions), show ready-to-paste SSH commands in UI.
  • Fix: nginx_manual_commands() generates exact cat heredoc commands for EasyEngine paths.

1.2.53

  • Fix: Nginx apply now uses exec()+cp fallback when open_basedir blocks direct file_put_contents – bypasses PHP filesystem restrictions.
  • Fix: Nginx writable check also uses exec() test so EasyEngine paths are recognized even when open_basedir blocks is_writable().
  • Fix: EasyEngine candidate always added to list regardless of detection result.
  • Fix: nginx_read_file() uses cat via exec() as fallback when file_get_contents is blocked.

1.2.52

  • Fix: nginx_config_paths() now returns candidates array matching ajax_nginx_apply() – fixes ‘undefined’ error on Zastosuj button.
  • Fix: ajax_nginx_remove() no longer references old reload_cmd key from config paths.
  • Fix: settings page EasyEngine detection uses detect_easyengine() with exec() fallback.

1.2.51

  • Fix: dashScan null guard – no longer crashes on settings page where dashboard elements do not exist.
  • Fix: EasyEngine detection now falls back to exec(ee –version) when open_basedir blocks /opt/easyengine.
  • Fix: Nginx Apply button now visible on all Nginx servers, tries multiple config paths and reload commands.
  • Fix: Kopiuj button onclick JS no longer leaks as visible text – config strings moved to inline script vars.

1.2.50

  • Add: Nginx config is now applied automatically via button in Settings – plugin writes config files and reloads Nginx without manual SSH access.
  • Add: EasyEngine support – auto-detects EasyEngine, writes to correct paths, runs ee site reload automatically.
  • Add: Nginx remove button to undo the configuration.

1.2.49

  • Fix: Nginx config snippet split into two separate blocks (http context for map, server context for location/types) – pasting both into one server {} block caused Nginx startup error.
  • Add: EasyEngine auto-detection – shows exact file paths (/opt/easyengine/sites/DOMAIN/config/nginx/custom/) and reload command.
  • Add: copy buttons for each Nginx config block.
  • Fix: types block (image/avif, image/webp) moved to server {} config – fixes octet-stream MIME type for directly requested .avif files on Nginx.

1.2.48

  • Fix: request-level cache for file_exists() in PHP WebP Serving – eliminates redundant filesystem calls per page load.
  • Add: Cloudflare API integration – auto-purge CF cache after WebP/AVIF/compress batch finishes (Zone ID + API Token in Settings).
  • Fix: compress batch now calls purge_page_caches() on finish (was missing, WebP and AVIF already did this).

1.2.47

  • Fix: add AddType image/avif .avif and AddType image/webp .webp to .htaccess block so Apache serves correct MIME types for directly requested next-gen image files.

1.2.46

  • Fix: błędny znak \* przed Version: w nagłówku pluginu – WordPress nie odczytywał numeru wersji, przez co wyświetlał “0.0” w powiadomieniu o aktualizacji.

1.2.45

  • Fix: status AVIF na dashboardzie pokazywał “brak srcset” mimo aktywnego PHP WebP Serving lub .htaccess – warunek sprawdzał tylko webp_srcset, zamiast webp_served (które uwzględnia wszystkie trzy metody serwowania).

1.2.44

  • Fix: przycisk “Wyczyść cache stron” zwracał 400 – akcja mits_purge_caches nie była zarejestrowana jako wp_ajax hook.

1.2.43

  • Fix: po zakończeniu konwersji WebP/AVIF plugin automatycznie czyści cache stron (WP Super Cache, Autoptimize, W3 Total Cache, WP Rocket, LiteSpeed Cache i inne) – eliminuje sytuację gdy cache serwuje stare URLe .jpg/.png mimo gotowych plików .webp.
  • Fix: PHP WebP Serving uruchamia się z priorytetem 1 zamiast 10 na template_redirect – plugin widzi finalny HTML po przetworzeniu przez Autoptimize i inne pluginy bufforujące output.
  • Improvement: ostrzeżenia o konflikcie WP Super Cache + PHP WebP Serving i Nginx + PHP WebP Serving są teraz precyzyjne – opisują konkretną przyczynę (cache zbudowany przez bota bez Accept: image/webp, obrazki JS-loaded) i wskazują rozwiązanie.

1.2.42

  • Fix: błędne ostrzeżenie o braku plików WebP w panelu ustawień gdy konwersja była już wykonana – licznik konfliktów liczył tylko jedno z pól done/converted zamiast ich sumy.

1.2.35

  • Fix: WebP scan no longer hangs on large libraries (100k+ images) – replaced glob() over entire uploads-webpc tree with a bounded 3-level dir walk that reads just one sample file.

1.2.34

  • Dashboard: status strip redesigned as horizontal pills above hero – coloured dot + label + value, whole pill clickable. Feature progress cards removed.

1.2.33

  • Dashboard: Onboarding checklist – 3-step guide (WebP conversion, serving, auto-compress) shown to new users, auto-dismisses when all done, hidden via localStorage after ✕.
  • Dashboard: Added AVIF serving status to settings strip (4th indicator) – shows srcset-based serving state or prompts to convert/configure.

1.2.32

  • Dashboard: Added settings status strip – 3 live indicators (WebP serving, Auto-compress, Alt texts) with colour-coded dots and direct action links. PHP now exposes webp_served and auto_compress flags to JS.

1.2.31

  • UX: Tabs reduced from 9 to 6 – Lossless, PNGJPG, Wymiary, Nieużywane moved into single “Narzędzia” tab with sub-navigation.
  • Dashboard: Added 3 feature status cards (WebP / Kompresja / AVIF) with live progress bars and quick-action buttons.

1.2.30

  • Debug: universal directory probe on every WebP scan – logs whether PHP can access uploads-webpc/, runs glob() to find actual .webp files, and shows first-fail file paths in both normal and large-library mode. [PROBE] and [DIAG] lines now appear in scan log regardless of library size.

1.2.29

  • Debug: show webp_diag paths in WebP Converter scan log – uploads_dir, sample file rel path, webpc candidate paths and file_exists results appear directly in the UI log after scanning.

1.2.27

  • Improve: admin menu icon redesigned – left half shows landscape photo (sun + hills), right half shows lightning bolt, separated by a subtle divider. More distinctive than the generic image placeholder.

1.2.26

  • Fix: webp_exists_for() now tries multiple candidate paths (with/without uploads subdir, realpath-resolved, WP_CONTENT_DIR) to correctly detect webp-converter-for-media files even in non-standard server layouts or after the plugin is disabled.
  • Add: panel descriptions – each tab now shows a one-sentence explanation of what it does and how it differs from similar tabs.

1.2.25

  • Fix: “O MITS” submenu page now sets the active panel server-side via PHP instead of relying on JS – eliminates timing/caching issues that caused the dashboard panel to appear instead of the About panel.

1.2.24

  • Fix: bumped asset version to bust browser cache for admin.js.

1.2.23

  • Fix: Imagick object not destroyed when exception thrown mid-conversion – memory leak in WebP/AVIF/JPEG conversions. All Imagick paths now use try-finally.
  • Fix: compress_imagick() had no try-catch – a write failure left a .mits_tmp orphan file on disk.
  • Fix: Deactivation now uses wp_unschedule_hook() instead of wp_clear_scheduled_hook() – properly removes all cron events including those registered with token arguments.
  • Fix: AVIF write test no longer uses sys_get_temp_dir() – uses plugin’s own state directory via wp_tempnam() to avoid world-readable /tmp on Linux.
  • Improve: ajax_dims_scan() pre-loads thumbnail IDs and post content in 2 queries instead of up to 2000 per-attachment queries – scan is now O(n) instead of O(n²).

1.2.22

  • Fix: Import Settings was saving to wrong option key – settings changes were silently discarded on page reload.
  • Security: ZIP restore now validates entry paths against path traversal (../ and absolute paths).
  • Security: ZIP filename input now stripped with basename() before sanitize_file_name() to prevent directory escape.
  • Fix: Race condition on batch start – all four start handlers (WebP/AVIF/compress/pngloss) now use an exclusive file lock to prevent token collision when two requests arrive simultaneously.
  • Improve: ORDER BY RAND() replaced with balanced oldest+newest offset sampling in compress scan and pngloss scan – significantly faster on large tables.
  • Improve: filesize() calls cached before sort in compress, pngloss, and WebP scan – eliminates O(n log n) filesystem reads.
  • Improve: Imagick version lookup in Debug page wrapped in try-catch – prevents fatal error on some hosting environments.
  • Improve: Log file now rotates at 512 KB instead of growing unbounded.

1.2.21

  • Improve: scan_images() now skips uploads-webpc/ and mits-image-optimizer/ directories during filesystem walk – reduces scan time on large libraries significantly.
  • Improve: Site Audit “large images without WebP” check uses DB sampling (300 balanced rows) instead of full filesystem walk for libraries over 5000 images.

1.2.20

  • Fix: .htaccess rules now also check uploads-webpc/ directory (webp-converter-for-media) – Apache/LiteSpeed will serve WebP from either location.
  • Fix: Nginx config snippet in settings was generating wrong try_files paths (image.jpg.webp instead of image.webp for MITS-native files) – now generates correct try_files with both MITS sibling and webpc paths.
  • Improve: Nginx config is now generated dynamically with actual upload paths of the installation (works correctly in subdirectory installs).
  • Improve: htaccess Vary header now uses FilesMatch scope instead of global env=REDIRECT_accept.

1.2.19

  • Fix: Przegląd tab now shows WebP statistics consistent with WebP Converter tab – uses authoritative scan result (webp_state) when available instead of a biased sample of recent images.
  • Fix: dashboard sample changed from “500 most recent” to balanced oldest-250 + newest-250, eliminating overestimation caused by recently-converted images skewing the average.
  • Fix: missing_webp suggestion in dashboard now uses the correct base count (jpeg/png/gif only) instead of all image attachments including .webp/.avif files.
  • Fix: db_estimate_done now samples oldest+newest images instead of newest-only, giving representative coverage across the full library.

1.2.18

  • Fix: WebP scan now correctly recognises images already converted by webp-converter-for-media plugin (stored in uploads-webpc/ directory) – previously all 100k+ images showed as “to convert” even when WebP versions existed.
  • Fix: replaced ORDER BY RAND() in db_estimate_done with ORDER BY post_id DESC – eliminates full-table scan on large libraries (100k+ images) that caused estimation to return 0.

1.2.17

  • Fix: “O MITS” submenu page now correctly shows About content instead of defaulting to Dashboard tab.
  • Add: large-library mode (5000+ images) – scans and batch processing switch to DB-offset mode, eliminating full filesystem walks and massive JSON state files. WebP, AVIF, Compress and Lossless converters all benefit.

1.2.16

  • Add: auto WebP generation on upload – creates .webp for main file and all thumbnail sizes (thumbnail, medium, large, custom) via wp_update_attachment_metadata hook.
  • Add: new “Generuj WebP automatycznie przy wgrywaniu” setting (auto_webp, default: on).
  • Change: PHP WebP Serving now enabled by default for new installations.
  • Add: support banner linking to mits.pl/kontakt on main plugin page and settings page.

1.2.15

  • Improve: welcome notice redesigned – compact single-line layout using WordPress native is-dismissible class, less intrusive.

1.2.14

  • Fix: MITS_OPT_VERSION constant correctly set to 1.2.14 – previous 1.2.13 release had version mismatch causing WP-CLI “version higher than expected” error.

1.2.13

  • Improve: PHP WebP Serving now uses output buffering (ob_start) to process the entire page HTML – replaces image URLs in Elementor inline style background-image, CSS blocks, and any other context not reachable via WP content filters. Fixes PageSpeed issues caused by large PNG background images in Elementor sections.

1.2.12

  • Fix: ajax_import_settings now checks actual .htaccess file state (htaccess_is_active) instead of DB value when deciding whether to remove rules – previously if DB already said false but file still had rules, removal was skipped.
  • Improve: conflict banner on settings page now has a one-click “⚡ Zastosuj zalecane ustawienia” button – no need to scroll to the import section.
  • Improve: after applying settings, conflicts list updates inline without page reload – form fields, top banner and inline list all update in place.
  • Improve: “Wygeneruj i zastosuj” can be triggered directly from the conflict banner button (generates recommended + applies in one click).

1.2.11

  • Fix: mits_import_settings and mits_recommended_settings were missing from the AJAX registration array – WordPress returned 0 for both actions causing “Błąd.” / “Błąd zapisu.” errors.

1.2.10

  • Add: Competing plugin detection in conflict checker – warns when WebP Converter for Media, ShortPixel, Smush, Imagify, EWWW, Optimole, TinyPNG or other optimization plugins are active alongside MITS.
  • Add: WP Super Cache + PHP WebP Serving conflict detection – warns about cache serving wrong format to non-WebP browsers.
  • Add: Autoptimize + PHP WebP Serving conflict hint.
  • Add: Import settings – new card on settings page with “Wygeneruj zalecane” button (picks optimal config for detected server: .htaccess for Apache/LiteSpeed, PHP WebP Serving for Nginx) and “Zastosuj” to apply JSON.
  • Add: mits_recommended_settings and mits_import_settings AJAX endpoints.
  • Add: After import, post-apply conflicts are shown inline without full page reload; page refreshes after 1.4s.

1.2.9

  • Add: Server detection (Apache / LiteSpeed / Nginx) – settings page now shows “Twój serwer” badge on the relevant section, disables .htaccess controls on Nginx with an explanatory banner, and highlights the Nginx config block.
  • Add: Settings conflict detection – plugin detects and displays warnings for conflicting configurations (e.g. .htaccess enabled on Nginx, double WebP serving, setting enabled but no .webp files exist).
  • Add: Conflicts section in settings page – shown as an orange banner above settings cards whenever conflicts are detected.
  • Add: Extended JSON debug export – now includes server info, Imagick format capabilities (WebP/AVIF read/write), disk free space, active plugins list, memory usage, PHP SAPI, WP_DEBUG state, locale, timezone, and conflict list.
  • Improve: Dashboard suggestions and score now server-aware – on Nginx, suggestions point to PHP WebP Serving / srcset instead of .htaccess; php_webp_serving counts toward webp_served score.
  • Improve: Audit no longer flags missing .htaccess on Nginx when PHP WebP Serving or srcset is active.
  • Improve: server type passed to JavaScript via mitsOptData.server for future JS-side hints.

1.2.8

  • Fix: .htaccess toggle button now keeps the database setting in sync with the actual .htaccess file state – previously toggling via the UI button could leave htaccess_webp option out of sync with reality.

1.2.7

  • Add: JSON export / debug button on Settings page – downloads a full status snapshot: plugin version, system info (PHP, GD, Imagick, memory), all settings, compression/WebP/AVIF/lossless stats, and last dashboard scan results.
  • Fix: Settings and About pages now inherit the full-width dark background layout matching the main optimizer page.

1.2.6

  • Fix: Settings page (?page=mits-settings) now renders a clean standalone view – plugin header + settings panels only, no tab navigation. Settings is only accessible from the WordPress sidebar menu.
  • Remove: Settings tab and panel removed from the main tabbed interface.

1.2.5

  • Fix: visiting ?page=mits-settings or ?page=mits-about now redirects to the main plugin page with the correct tab pre-selected, instead of rendering the full interface again from scratch.

1.2.4

  • Fix: “Ustawienia” tab added to the main navigation bar – visiting ?page=mits-settings now correctly opens the settings panel instead of showing the dashboard. .htaccess and compression controls are now always reachable via the tab.

1.2.3

  • Fix: dashboard suggestion buttons for “.htaccess” and “Settings” now navigate correctly to the Settings submenu page instead of silently failing (the settings panel is a separate WP admin page, not a tab).

1.2.2

  • Fix: JPEG WebP scanner now finds ALL JPEG attachments, including those that already have a .webp sidecar (created by bulk WebP Converter). Previously these were skipped, showing “no files found” on sites where WebP Converter had already run.
  • Improvement: JPEG WebP conversion reuses an existing .webp sidecar file instead of re-encoding, then removes the original JPEG and updates WordPress metadata. Column in results table shows current WebP size alongside JPEG size.

1.2.1

  • Fix: .htaccess block now includes AVIF serving rules before WebP – browsers receive .avif when the file exists, falling back to .webp then original. Existing installations with .htaccess active are updated automatically on next save.
  • Fix: PHP WebP Serving now also activates for browsers that send image/avif in the Accept header; AVIF is preferred over WebP when both exist.
  • Fix: WebP/AVIF srcset filters (WebP in srcset + PHP Serving) now prefer AVIF over WebP when the browser accepts it.
  • Fix: image scanner (bulk compress, WebP/AVIF scan) no longer skips files in directories with unreadable subdirectories; uses CATCH_GET_CHILD to continue past permission errors instead of aborting silently.
  • Fix: removed false-negative check in scan_images that could exclude .jpg files in edge-case directory structures.
  • Improvement: Nginx configuration snippet updated – dual map variables for AVIF and WebP with try_files fallback chain.

1.2.0

  • Add: JPEG WebP converter in the PNG JPG tab – scans all JPEG attachments without a .webp counterpart, converts each one and replaces the original, updates WordPress metadata, thumbnails, and all content URLs.
  • Change: PNG scan now finds all PNG files regardless of size (previously filtered to ≥ 150 KB).

1.1.0

  • Add: PNG backup restore – lists saved backup ZIPs, one-click restore extracts original PNGs, reverts WordPress metadata, content URLs, and removes .webp files.
  • Fix: PNG WebP table no longer clips the action button – removed conflicting overflow:hidden from card.
  • Fix: Admin notices from other plugins (AccessiYes, Rank Math, etc.) are now suppressed on all MITS pages.

1.0.9

  • Fix: PNG WebP conversion now handles the case where a .webp file already exists (created by WebP Converter) – instead of blocking with “file exists”, it skips re-encoding and proceeds to delete the PNG source and update WordPress metadata.

1.0.8

  • Add: PHP WebP Serving – replaces image URLs in HTML output with .webp versions when the browser supports WebP and the .webp file exists. Works on Apache and Nginx without any server configuration. Sends Vary: Accept header for correct caching behaviour. Off by default.

1.0.7

  • Add: “Pobierz ZIP (backup)” button on PNG JPG/WebP tab – creates a ZIP archive of all found PNG originals for safe local backup before conversion.
  • Change: “Konwertuj wszystkie” now automatically creates a backup ZIP before starting batch conversion; conversion is blocked if backup fails.

1.0.6

  • Add: “Konwertuj wszystkie” bulk button on the PNG JPG/WebP tab – converts all found PNG files in one click without losing the per-file option.

1.0.5

  • Add: Nginx WebP serving configuration snippet in Settings (alongside Apache .htaccess).
  • Change: .htaccess and Nginx sections moved into the Settings page; removed separate .htaccess tab.
  • Change: Settings and O MITS moved to WordPress sidebar submenu for easier access.

1.0.4

  • Add: Welcome notice shown after plugin activation with 3-step quick-start guide and a dismiss button.

1.0.3

  • Fix: Dashboard scan no longer scans the filesystem – uses WordPress database queries instead, making it instant even on stores with 100k+ products.
  • Fix: WebP/AVIF coverage is now estimated from a 500-attachment sample (extrapolated to full library) rather than iterating all files.

1.0.2

  • Add: “Settings” quick-link on the Plugins list page.
  • Fix: Missing logo-mits.svg causing 404 in the admin header.

1.0.1

  • Fix: AJAX handlers now return proper JSON error responses instead of HTTP 500 HTML on unexpected PHP errors.
  • Add: Built-in error logger – errors are saved to a log file in the uploads directory for easier debugging.
  • Add: Hidden diagnostic page at wp-admin/admin.php?page=mits-debug showing system info (PHP, GD, Imagick, upload directory permissions, WP-Cron status) and the error log with a clear button.

1.0.0

  • Initial release.
  • Auto-compression on upload with configurable quality and max-width.
  • Bulk compression with background batch processing and progress tracking.
  • WebP Converter with Imagick and GD support.
  • AVIF Converter with Imagick 7+ and GD imageavif() support.
  • Apache .htaccess automatic WebP serving configuration.
  • Image Dimensions Scanner detecting oversized images in use.
  • Site Audit with checks for missing alt, SSL, Open Graph, plugin updates, and more.
  • WordPress Dashboard Widget with optimization statistics.