From f539297182044af48180632c17da79ec52e36520 Mon Sep 17 00:00:00 2001 From: Dakotah Intriglia Date: Wed, 16 Dec 2020 17:09:55 -0700 Subject: [PATCH] Check for and exclude thumbnails There is no checking for thumbnails already imported to the wordpress library, so if a thumbnail is detected, it should be ignored from the list. I also added checking for original images from updraft to exclude those from the list as well. --- class.add-from-server.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/class.add-from-server.php b/class.add-from-server.php index 5b14ddd..29cc112 100644 --- a/class.add-from-server.php +++ b/class.add-from-server.php @@ -522,6 +522,13 @@ function main_content() { } else if ( 'unreadable' === $file['error'] ) { $error_str = __( 'Sorry, but this file is unreadable by your Webserver. Perhaps check your File Permissions?', 'add-from-server' ); } + + // Check for and exclude thumbnails images + preg_match_all('/.*\dx\d+\.(png|jpg|jpeg)/m', $file['text'], $matches, PREG_SET_ORDER, 0); + if (count($matches)) continue; + + // Check for and exclude updraft images + if (stripos($file['text'],'updraft-pre-smush-original') !== false) continue; printf( '