Code Duplication    Length = 23-23 lines in 2 locations

projects/packages/post-images/src/class-post-images.php 1 location

@@ 828-850 (lines=23) @@
825
			return false;
826
		}
827
828
		if ( ! empty( $meta['videopress'] ) ) {
829
			// Use poster image for VideoPress videos.
830
			$url         = $meta['videopress']['poster'];
831
			$meta_width  = $meta['videopress']['width'];
832
			$meta_height = $meta['videopress']['height'];
833
		} elseif ( ! empty( $meta['thumb'] ) ) {
834
			// On WordPress.com, VideoPress videos have a 'thumb' property with the
835
			// poster image filename instead.
836
			$media_url   = wp_get_attachment_url( $attachment_id );
837
			$url         = str_replace( wp_basename( $media_url ), $meta['thumb'], $media_url );
838
			$meta_width  = $meta['width'];
839
			$meta_height = $meta['height'];
840
		} elseif ( wp_attachment_is( 'video', $attachment_id ) ) {
841
			// We don't have thumbnail images for non-VideoPress videos - skip them.
842
			return false;
843
		} else {
844
			if ( ! isset( $meta['width'] ) || ! isset( $meta['height'] ) ) {
845
				return false;
846
			}
847
			$url         = wp_get_attachment_url( $attachment_id );
848
			$meta_width  = $meta['width'];
849
			$meta_height = $meta['height'];
850
		}
851
852
		if ( $meta_width < $width || $meta_height < $height ) {
853
			return false;

projects/plugins/jetpack/class.jetpack-post-images.php 1 location

@@ 843-865 (lines=23) @@
840
			return false;
841
		}
842
843
		if ( ! empty( $meta['videopress'] ) ) {
844
			// Use poster image for VideoPress videos.
845
			$url         = $meta['videopress']['poster'];
846
			$meta_width  = $meta['videopress']['width'];
847
			$meta_height = $meta['videopress']['height'];
848
		} elseif ( ! empty( $meta['thumb'] ) ) {
849
			// On WordPress.com, VideoPress videos have a 'thumb' property with the
850
			// poster image filename instead.
851
			$media_url   = wp_get_attachment_url( $attachment_id );
852
			$url         = str_replace( wp_basename( $media_url ), $meta['thumb'], $media_url );
853
			$meta_width  = $meta['width'];
854
			$meta_height = $meta['height'];
855
		} elseif ( wp_attachment_is( 'video', $attachment_id ) ) {
856
			// We don't have thumbnail images for non-VideoPress videos - skip them.
857
			return false;
858
		} else {
859
			if ( ! isset( $meta['width'] ) || ! isset( $meta['height'] ) ) {
860
				return false;
861
			}
862
			$url         = wp_get_attachment_url( $attachment_id );
863
			$meta_width  = $meta['width'];
864
			$meta_height = $meta['height'];
865
		}
866
867
		if ( $meta_width < $width || $meta_height < $height ) {
868
			return false;