You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (empty($_POST['tiny-bulk-compress']) && empty($_REQUEST['ids'])) {
212
-
echo'<p>' . self::translate_escape("Use this tool to compress all images via the Tiny API service") . '.</p>';
213
-
echo'<p>' . self::translate_escape("To begin, just press the button below") . '.</p>';
216
+
$result = $wpdb->get_results("SELECT COUNT(*) AS `count` FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID DESC", ARRAY_A);
217
+
$count = $result[0]['count'];
218
+
219
+
echo'<p>' . self::translate_escape("Use this tool to compress all images in your media library") . '. ';
220
+
echoself::translate_escape("Only images that have not been compressed will be compressed") . '.</p>';
221
+
echo'<p>' . sprintf(self::translate_escape("We have found %d images in your media library"), $count) . '. ';
222
+
echoself::translate_escape("To begin, just press the button below") . '.</p>';
self::translate_escape('Compress all images') . '</p>';
219
229
echo'</form>';
220
230
} else {
221
231
check_admin_referer('tiny-bulk-compress');
@@ -227,7 +237,6 @@ public function bulk_compress_page() {
227
237
$cond = "";
228
238
}
229
239
230
-
global$wpdb;
231
240
// Get all ids and names of the images and not the whole objects which will only fill memory
232
241
$items = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' $cond ORDER BY ID DESC", ARRAY_A);
233
242
@@ -239,7 +248,7 @@ public function bulk_compress_page() {
239
248
echo"</p>";
240
249
241
250
echo'<div id="tiny-status"><p>'. self::translate_escape('Compressions this month') . sprintf(' <span>%d</span></p></div>', $this->settings->get_status());
0 commit comments