Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/1.7.0' into feature/stats
Browse files Browse the repository at this point in the history
  • Loading branch information
av3nger committed Nov 21, 2023
2 parents 40f1a54 + 56e136a commit 50b3a91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Fixed:
* Notices getting injected into plugin navigation
* Do not expose internal methods to WP CLI commands
* WP CLI command only processing the first 10 images
* Auto resize feature using incorrect descriptors

= 1.6.0 - 12.11.2023 =

Expand Down
8 changes: 4 additions & 4 deletions app/class-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,20 @@ private function offload_all() {
$progress = WP_CLI\Utils\make_progress_bar( __( 'Offloading images', 'cf-images' ), $images->found_posts );

foreach ( $images->posts as $attachment ) {
$metadata = wp_get_attachment_metadata( $attachment->ID );
$metadata = wp_get_attachment_metadata( $attachment );
if ( false === $metadata ) {
$errors[] = sprintf( /* translators: %d - attachment ID */
esc_html__( 'Image metadata not found (attachment ID: %d).', 'cf-images' ),
$attachment->ID
$attachment
);
} else {
( new Media() )->upload_image( $metadata, $attachment->ID );
( new Media() )->upload_image( $metadata, $attachment );

if ( is_wp_error( Core::get_error() ) ) {
$errors[] = sprintf( /* translators: %1$s - error message, %2$d - attachment ID */
esc_html__( '%1$s (attachment ID: %2$d).', 'cf-images' ),
esc_html( Core::get_error()->get_error_message() ),
$attachment->ID
$attachment
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/modules/class-auto-resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function add_srcset_to_image( string $image_dom, Image $image ): string {
break;
}

$srcset[] = $image->get_cf_image() . 'w=' . $size . ' ' . $size . 'px';
$srcset[] = $image->get_cf_image() . 'w=' . $size . ' ' . $size . 'w';
}

unset( $size );
Expand All @@ -90,7 +90,7 @@ public function add_srcset_to_image( string $image_dom, Image $image ): string {
}

// Add the original image to the srcset.
$srcset[] = $image->get_cf_image() . 'w=' . $image->get_width() . ' ' . $image->get_width() . 'px';
$srcset[] = $image->get_cf_image() . 'w=' . $image->get_width() . ' ' . $image->get_width() . 'w';

// Check if there is already a 'sizes' attribute.
$sizes = strpos( $image_dom, ' sizes=' );
Expand Down

0 comments on commit 50b3a91

Please sign in to comment.