Skip to content

Instantly share code, notes, and snippets.

@BhargavBhandari90
Created September 18, 2025 13:46
Show Gist options
  • Save BhargavBhandari90/3a9c7583ce047f94863c12e3257c1991 to your computer and use it in GitHub Desktop.
Save BhargavBhandari90/3a9c7583ce047f94863c12e3257c1991 to your computer and use it in GitHub Desktop.
<?php
function fp_scan_all_nonoptimized_images()
{
$upload_dir = wp_upload_dir();
$uploads_path = $upload_dir['basedir'];
$uploads_url = $upload_dir['baseurl'];
$optimized_path = WP_CONTENT_DIR . '/flying-press-images';
$batch = [];
foreach (fp_scan_images_generator_proloy() as $file) {
$optimized_file = str_replace($uploads_path, $optimized_path, $file);
if (is_file($optimized_file)) {
continue;
}
$batch[] = $file;
}
if ($batch) {
error_log(print_r($batch,true));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment