Code Duplication    Length = 6-6 lines in 2 locations

includes/CMB2_Field_Display.php 1 location

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

includes/types/CMB2_Type_File.php 1 location

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