Code Duplication    Length = 6-6 lines in 2 locations

includes/CMB2_Field_Display.php 1 location

@@ 396-401 (lines=6) @@
393
		if ( $field_type->is_valid_img_ext( $url_value ) ) {
394
			$img_size = $this->field->args( 'preview_size' );
395
396
			if ( $id ) {
397
				$image = wp_get_attachment_image( $id, $img_size, null, array( 'class' => 'cmb-image-display' ) );
398
			} else {
399
				$size = is_array( $img_size ) ? $img_size[0] : 200;
400
				$image = '<img class="cmb-image-display" style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $url_value . '" alt="" />';
401
			}
402
403
			echo $image;
404

includes/types/CMB2_Type_File.php 1 location

@@ 71-76 (lines=6) @@
68
69
			if ( $this->is_valid_img_ext( $meta_value ) ) {
70
71
				if ( $_id_value ) {
72
					$image = wp_get_attachment_image( $_id_value, $img_size, null, array( 'class' => 'cmb-file-field-image' ) );
73
				} else {
74
					$size = is_array( $img_size ) ? $img_size[0] : 350;
75
					$image = '<img style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $meta_value . '" alt="" />';
76
				}
77
78
				$output .= $this->img_status_output( array(
79
					'image'     => $image,