src/Service.php
private function _convertFromLegacy(array $legacy): array
	{
		$width = intval($legacy['width'] ?? 0);
		$height = intval($legacy['height'] ?? 0);
		$imageUrl = $legacy['thumbnailUrl'] ?? null;
		$imageWidth = intval($legacy['thumbnailWidth'] ?? 0);
		$imageHeight = intval($legacy['thumbnailHeight'] ?? 0);

		return [
			'title' => $legacy['title'] ?? null,
			'description' => $legacy['description'] ?? null,
			'url' => $legacy['url'] ?? null,
			'type' => $legacy['type'] ?? null,
			'images' => $imageUrl ? [[
				'url' => $imageUrl,
				'width' => $imageWidth,
				'height' => $imageHeight,
				'size' => $imageWidth * $imageHeight,
				'mime' => null,
			]] : [],
			'image' => $imageUrl,
			'imageWidth' => $imageWidth,
			'imageHeight' => $imageHeight,
			'code' => Template::raw($legacy['html'] ?? $legacy['safeHtml'] ?? ''),
			'width' => $width,
			'height' => $height,
			'aspectRatio' => $width > 0 ? $height / $width * 100 : 0,
			'authorName' => $legacy['authorName'] ?? null,
			'authorUrl' => $legacy['authorUrl'] ?? null,
			'providerName' => $legacy['providerName'] ?? null,
			'providerUrl' => $legacy['providerUrl'] ?? null,
		];
	}
private function _convertFromLegacy(array $legacy): array
	{
		$width = intval($legacy['width'] ?? 0);
		$height = intval($legacy['height'] ?? 0);
		$imageUrl = $legacy['thumbnailUrl'] ?? null;
		$imageWidth = intval($legacy['thumbnailWidth'] ?? 0);
		$imageHeight = intval($legacy['thumbnailHeight'] ?? 0);

		return [
			'title' => $legacy['title'] ?? null,
			'description' => $legacy['description'] ?? null,
			'url' => $legacy['url'] ?? null,
			'type' => $legacy['type'] ?? null,
			'images' => $imageUrl ? [[
				'url' => $imageUrl,
				'width' => $imageWidth,
				'height' => $imageHeight,
				'size' => $imageWidth * $imageHeight,
				'mime' => null,
			]] : [],
			'image' => $imageUrl,
			'imageWidth' => $imageWidth,
			'imageHeight' => $imageHeight,
			'code' => Template::raw($legacy['html'] ?? $legacy['safeHtml'] ?? ''),
			'width' => $width,
			'height' => $height,
			'aspectRatio' => $width > 0 ? $height / $width * 100 : 0,
			'authorName' => $legacy['authorName'] ?? null,
			'authorUrl' => $legacy['authorUrl'] ?? null,
			'providerName' => $legacy['providerName'] ?? null,
			'providerUrl' => $legacy['providerUrl'] ?? null,
		];
	}
private function _convertFromLegacy ( array $ legacy ) : array { $ width = intval ( $ legacy [ 'width' ] ?? 0 ) ; $ height = intval ( $ legacy [ 'height' ] ?? 0 ) ; $ imageUrl = $ legacy [ 'thumbnailUrl' ] ?? null ; $ imageWidth = intval ( $ legacy [ 'thumbnailWidth' ] ?? 0 ) ; $ imageHeight = intval ( $ legacy [ 'thumbnailHeight' ] ?? 0 ) ; return [ 'title' => $ legacy [ 'title' ] ?? null , 'description' => $ legacy [ 'description' ] ?? null , 'url' => $ legacy [ 'url' ] ?? null , 'type' => $ legacy [ 'type' ] ?? null , 'images' => $ imageUrl ? [ [ 'url' => $ imageUrl , 'width' => $ imageWidth , 'height' => $ imageHeight , 'size' => $ imageWidth * $ imageHeight , 'mime' => null , ] ] : [ ] , 'image' => $ imageUrl , 'imageWidth' => $ imageWidth , 'imageHeight' => $ imageHeight , 'code' => Template :: raw ( $ legacy [ 'html' ] ?? $ legacy [ 'safeHtml' ] ?? '' ) , 'width' => $ width , 'height' => $ height , 'aspectRatio' => $ width > 0 ? $ height / $ width * 100 : 0 , 'authorName' => $ legacy [ 'authorName' ] ?? null , 'authorUrl' => $ legacy [ 'authorUrl' ] ?? null , 'providerName' => $ legacy [ 'providerName' ] ?? null , 'providerUrl' => $ legacy [ 'providerUrl' ] ?? null , ] ; }
Creates an "embedded asset ready" array from an array matching the Craft 2 version of the plugin.

@param array $legacy
@return array
Creates an embedded asset ready array from an array matching the Craft 2 version of the plugin .