Petro SEO Images to WebP

Descrição

Petro SEO Images to WebP converts your existing JPEG and PNG attachments to WebP in bulk, then serves them on the front-end through the standard <picture> element with a full responsive srcset. The original files stay untouched on disk, so reverting is as simple as flipping a switch.

Designed to be small, dependency-free and predictable. No external services, no images uploaded anywhere, no opaque queue.

What it does

  • Converts every registered image size (full + thumbnails) to .webp next to the original (e.g. photo.jpg photo.jpg.webp).
  • Wraps <img> tags from wp_get_attachment_image() and the_content in <picture><source type="image/webp">…</picture>, preserving full srcset and sizes.
  • Skips images automatically if a previous run failed because of filesystem permissions, so you can retry on demand without reprocessing the whole library.
  • Ramps the WebP quality down (75 60 45 40) when the encoded file ends up larger than the original, so you never ship a “WebP” that is heavier than the JPEG.
  • Idempotent: re-running the bulk job only touches new or updated images.

What it does NOT do

  • It does not delete or modify your original JPG/PNG files.
  • It does not require Imagick or a specific image library beyond what WordPress already uses (wp_get_image_editor()).
  • It does not phone home, register endpoints, or load remote scripts.

Privacy

The plugin processes images locally using WordPress’s built-in image editor. No data is sent to third-party services.

Instalação

  1. Upload the petro-seo-images-to-webp folder to /wp-content/plugins/, or install via the Plugins screen.
  2. Activate the plugin through the Plugins screen.
  3. Go to Media Petro SEO Images to WebP.
  4. Click Convert all to process the existing library.
  5. Make sure Serve WebP is enabled to wrap front-end images in <picture>.

Perguntas frequentes

Will this overwrite my original images?

No. Originals stay on disk. The plugin writes a sibling file with the .webp extension (e.g. photo.jpg and photo.jpg.webp).

How can I undo the conversion?

On Media Petro SEO Images to WebP, click Revert all. Every generated .webp file is removed and the tracking metadata is cleared.

Some images were skipped. Why?

The most common cause is a write-permission issue on the uploads folder. Fix the directory permissions (e.g. chown www-data:www-data on Linux) and click Retry skipped to reprocess only those.

Does it work with responsive images / srcset?

Yes. The <source> element inside <picture> carries the full srcset and sizes, with each URL pointing to its .webp counterpart. URLs whose .webp is missing on disk are silently dropped from the WebP srcset so the browser falls back to the original <img>.

Can I serve `.webp` files without using the “ tag?

If you uncheck Serve WebP the files stay on disk but the plugin will not wrap your <img> markup. You can then serve them yourself (e.g. via Nginx Accept negotiation or a CDN rule).

What if the WebP version ends up larger than the original?

The plugin retries with progressively lower quality (down to 40). If even at the lowest quality the WebP is still bigger than the source, it logs a diagnostic line and uses what it has — most browsers will still benefit from the format.

Avaliações

Não há avaliações para este plugin.

Colaboradores e desenvolvedores

“Petro SEO Images to WebP” é um programa de código aberto. As seguintes pessoas contribuíram para este plugin.

Colaboradores

Registro de alterações

1.1.2

  • Admin UI polish: ASCII-art header on Media Petro SEO Images to WebP and a discreet author credit linking to the wordpress.org profile. No functional changes — purely cosmetic.

1.1.1

  • Plugin Check pass: drop empty .gitkeep placeholders from includes/ and assets/ (they no longer make it into the release zip).
  • Replace direct is_writable() / chmod() filesystem calls with wp_is_writable(); the opportunistic chmod 0755 self-heal is gone — read-only directories now surface a clean permission error instead of being silently patched.
  • Drop the load_plugin_textdomain() call; wordpress.org auto-loads translations since WP 4.6.
  • Wrap uninstall.php logic in a psitw_uninstall() function so locals stay out of the file scope.
  • Annotate the unavoidable direct $wpdb queries (uninstall sweep, namespace migration, skipped-meta cleanup) and meta_query / post__not_in calls with justified phpcs:ignore comments.

1.1.0

  • Rebrand to Petro SEO Images to WebP: new plugin slug petro-seo-images-to-webp, new internal prefix Psitw_* / psitw_* (5-letter prefix per WordPress plugin guidelines). A one-time auto-migration on first load forwards every legacy storage key (siw_* and plugin_images_*) into the new namespace, so existing conversion state is preserved.
  • The admin page moved to Media Petro SEO Images to WebP.

1.0.4

  • Rename internal class prefix and storage keys to siw_* for unique namespacing — a one-time auto-migration runs on first load and copies legacy data forward.
  • Replace @unlink with wp_delete_file() and add Plugin URI, Author URI, Requires at least headers for wordpress.org compliance.
  • Trim readme tags to 5, bump tested-up-to, exclude dev-only docs from the release zip.

1.0.3

  • Skip attachments that fail because of filesystem permissions and offer a one-click retry flow.
  • Ramp quality down when the resulting WebP is larger than the original.
  • Keep the bulk loop alive when an entire batch fails by excluding failed IDs.
  • Preserve full responsive srcset inside the generated <picture><source>.

1.0.0

  • Initial public release.