wp-content/plugins/wordpress-seo/frontend/class-opengraph-image.php
/**
	 * Adds an image to the list by attachment ID.
	 *
	 * @param int $attachment_id The attachment ID to add.
	 *
	 * @return void
	 */
Adds an image to the list by attachment ID.
@param int $attachment_id The attachment ID to add.

@return void
Adds an image to the list by attachment ID . @param int $attachment_id The attachment ID to add . @return void
protected function add_image_by_id( $attachment_id ) {
		if ( ! $this->is_valid_attachment( $attachment_id ) ) {
			return;
		}
		if ( $this->is_size_overridden() ) {
			$this->get_overridden_image( $attachment_id );
			return;
		}
		$variations = WPSEO_Image_Utils::get_variations( $attachment_id );
		$variations = WPSEO_Image_Utils::filter_usable_dimensions( $this->image_params, $variations );
		$variations = WPSEO_Image_Utils::filter_usable_file_size( $variations );
		if ( empty( $variations ) ) {
			return;
		}
		$attachment = $variations[0];
		if ( $attachment ) {
			$this->add_image( $attachment );
		}
	}
protected function add_image_by_id ( $ attachment_id ) { if ( ! $ this -> is_valid_attachment ( $ attachment_id ) ) { return ; } if ( $ this -> is_size_overridden ( ) ) { $ this -> get_overridden_image ( $ attachment_id ) ; return ; } $ variations = WPSEO_Image_Utils :: get_variations ( $ attachment_id ) ; $ variations = WPSEO_Image_Utils :: filter_usable_dimensions ( $ this -> image_params , $ variations ) ; $ variations = WPSEO_Image_Utils :: filter_usable_file_size ( $ variations ) ; if ( empty ( $ variations ) ) { return ; } $ attachment = $ variations [ 0 ] ; if ( $ attachment ) { $ this -> add_image ( $ attachment ) ; } }
Adds an image to the list by attachment ID.
Adds an image to the list by attachment ID .
// If we are left without variations, there is no valid variation for this attachment. // The variations are ordered so the first variations is by definition the best one.