diff --git a/includes/transformer/class-post.php b/includes/transformer/class-post.php index 093b354e..42afbfcb 100644 --- a/includes/transformer/class-post.php +++ b/includes/transformer/class-post.php @@ -249,7 +249,7 @@ protected function get_classic_editor_image_embeds( $max_images ) { // This linter warning is a false positive - we have to // re-count each time here as we modify $images. // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found - while ( $tags->next_tag( 'img' ) && ( \count( $images ) < $max_images ) ) { + while ( $tags->next_tag( 'img' ) && ( \count( $images ) <= $max_images ) ) { $src = $tags->get_attribute( 'src' ); // If the img source is in our uploads dir, get the @@ -311,7 +311,7 @@ protected function get_classic_editor_images( $max_images ) { $images[] = \get_post_thumbnail_id( $id ); } - if ( \count( $images ) < $max_images ) { + if ( \count( $images ) <= $max_images ) { if ( \class_exists( '\WP_HTML_Tag_Processor' ) ) { $images = \array_merge( $images, $this->get_classic_editor_image_embeds( $max_images ) ); } else { @@ -427,14 +427,14 @@ public static function wp_attachment_to_activity_attachment( $media ) { // switching on image/audio/video switch ( $mime_type_parts[0] ) { case 'image': - $image_size = 'full'; + $image_size = 'large'; /** * Filter the image URL returned for each post. * * @param array|false $thumbnail The image URL, or false if no image is available. * @param int $id The attachment ID. - * @param string $image_size The image size to retrieve. Set to 'full' by default. + * @param string $image_size The image size to retrieve. Set to 'large' by default. */ $thumbnail = apply_filters( 'activitypub_get_image', @@ -488,16 +488,16 @@ public static function wp_attachment_to_activity_attachment( $media ) { * Return details about an image attachment. * * @param int $id The attachment ID. - * @param string $image_size The image size to retrieve. Set to 'full' by default. + * @param string $image_size The image size to retrieve. Set to 'large' by default. * * @return array|false Array of image data, or boolean false if no image is available. */ - protected static function get_wordpress_attachment( $id, $image_size = 'full' ) { + protected static function get_wordpress_attachment( $id, $image_size = 'large' ) { /** * Hook into the image retrieval process. Before image retrieval. * * @param int $id The attachment ID. - * @param string $image_size The image size to retrieve. Set to 'full' by default. + * @param string $image_size The image size to retrieve. Set to 'large' by default. */ do_action( 'activitypub_get_image_pre', $id, $image_size ); @@ -507,7 +507,7 @@ protected static function get_wordpress_attachment( $id, $image_size = 'full' ) * Hook into the image retrieval process. After image retrieval. * * @param int $id The attachment ID. - * @param string $image_size The image size to retrieve. Set to 'full' by default. + * @param string $image_size The image size to retrieve. Set to 'large' by default. */ do_action( 'activitypub_get_image_post', $id, $image_size );