Skip to content

Commit 0d38696

Browse files
author
Jippe Holwerda
committed
Do not compress attachments if there is no metadata.
1 parent bce68d2 commit 0d38696

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/class-tiny-plugin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ private function compress($metadata, $attachment_id) {
136136
}
137137

138138
public function compress_attachment($metadata, $attachment_id) {
139-
list($tiny_metadata, $result) = $this->compress($metadata, $attachment_id);
140-
return $tiny_metadata->update_wp_metadata($metadata);
139+
if (!empty($metadata)) {
140+
list($tiny_metadata, $result) = $this->compress($metadata, $attachment_id);
141+
return $tiny_metadata->update_wp_metadata($metadata);
142+
}
141143
}
142144

143145
public function compress_image() {

0 commit comments

Comments
 (0)