Optimize the Images in a Post Before You Publish with Robin and AI
Every image in one post checked and, after your yes, the unoptimized ones compressed before it goes live.
Prerequisites
A site connected to WPVibe running Robin Image Optimizer 2.1 or newer (tested on 2.1.2, free) on WordPress 6.9 or newer, with an administrator account.
My WordPress site uses Robin Image Optimizer. Optimize the images in my post [the post's title] before I publish it. 1. Run discover_abilities with category robin-image-optimizer. If the abilities this needs are not there, stop and tell me to install or update the free Robin Image Optimizer plugin (2.1 or newer, on WordPress 6.9 or newer). 2. Find the post: run rest_api GET /wp/v2/posts with search set to the title, status draft,pending,future,publish and context edit. If nothing matches, search /wp/v2/pages the same way. If still nothing matches, tell me and stop. If several match, show me their titles and dates and ask which one. Do not change the post. 3. Collect the image IDs: every wp-image-NUMBER class and every image block id in content.raw (image and gallery blocks), plus featured_media if it is above 0. Leave out duplicates. If there are none, tell me no media library images were found in the post's content; if the post is built with a page builder such as Elementor, its images are not in the content, so this recipe doesn't cover it. Then stop. If there are more than 20, use the first 20 and tell me. 4. Run robin/get-optimization-policy and note compression_mode, convert_webp and thumbnail_sizes. If backup_originals is false, tell me the originals won't be backed up, so this can't be undone, and wait for my yes. 5. Run robin/get-job with media_ids set to those IDs. Leave out images whose status is success (already optimized), skip (Robin skipped it), queued or processing (Robin is already on them), error (it failed before; the recipe for failed images covers it) or unsupported_format, and tell me which. If an image has excluded true, ask me before including it. If nothing is left, tell me the images are already optimized and stop. Show me the images you will compress (file names) and the compression mode, and wait for my yes. 6. Run robin/optimize-media with media_ids set to the images left and profile set to the policy's compression_mode. While done is false, run it again with the same input and the returned cursor. If it returns an error (for example, the backup folder can't be written), tell me its message and stop. 7. Run robin/get-job with those IDs and report each image: status, saved_percent, whether it has a backup (backed_up) and a WebP copy (webp_size above 0), and any error. Say which compression mode was used. Tell me saved_percent covers the main file and the sizes in thumbnail_sizes, and counts the WebP copy when convert_webp is true. If convert_webp is false, look at the sizeSlug of each image block in the post (full is the main file, which Robin compresses; with no sizeSlug, check the size in the file name of the image URL): tell me the other sizes it shows that are not in thumbnail_sizes (for example large) were not compressed, so those images are no lighter for visitors. Leave the post as it is: don't publish it.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Optimize the Images in a Post Before You Publish with Robin and AI” recipe from the WPVibe cookbook on my connected site.
You just added a handful of big photos to a new post. Robin may get to them later, or not at all if automatic optimization is off, and the post goes live heavy. Checking each image on the Media Library screen before you publish is the step that gets skipped.
The AI finds the post, collects the images in it and its featured image, and checks each one in Robin Image Optimizer. It compresses only the ones not yet optimized, with your saved compression mode and a backup of each original when Robin’s backups are on, then shows you the result for each image. It asks before compressing anything. The post itself is not changed or published.
Name the post by its title. It works for posts and pages made in the block editor or the classic editor; page builders keep their images elsewhere. The AI handles at most 20 images, so it suits one post, not a whole site; for your whole library, use Robin’s Optimize page. If an image looks worse afterwards, this recipe puts the original back.
Outcome
The images in that post are optimized, with a backup of each original when backups are on, and you know what changed for each one, including any sizes the post shows that were not compressed. The post is unchanged.