wp_xmlrpc_server::_prepare_media_item( object $media_item, string $thumbnail_size = 'thumbnail' )

Prepares media item data for return in an XML-RPC object.


Parameters

$media_item

(Required) The unprepared media item data.

$thumbnail_size

(Optional) The image size to use for the thumbnail URL.

Default value: 'thumbnail'


Return

(array) The prepared media item data.


Source

File: wp-includes/class-wp-xmlrpc-server.php

	protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) {
		$_media_item = array(
			'attachment_id'    => strval( $media_item->ID ),
			'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
			'parent'           => $media_item->post_parent,
			'link'             => wp_get_attachment_url( $media_item->ID ),
			'title'            => $media_item->post_title,
			'caption'          => $media_item->post_excerpt,
			'description'      => $media_item->post_content,
			'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
			'type'             => $media_item->post_mime_type
		);

		$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
		if ( $thumbnail_src )
			$_media_item['thumbnail'] = $thumbnail_src[0];
		else
			$_media_item['thumbnail'] = $_media_item['link'];

		/**
		 * Filters XML-RPC-prepared data for the given media item.
		 *
		 * @since WP-3.4.0
		 *
		 * @param array  $_media_item    An array of media item data.
		 * @param object $media_item     Media item object.
		 * @param string $thumbnail_size Image size.
		 */
		return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size );
	}