core-bundle/src/Resources/contao/classes/StyleSheets.php
protected function generateBase64Image($strImage, $arrParent)
	{
		if ($arrParent['embedImages'] > 0 && file_exists($this->strRootDir . '/' . $strImage))
		{
			$objImage = new File($strImage);
			$strMime = $objImage->extension;

			// Adjust the mime types
			if ($strMime == 'jpg')
			{
				$strMime = 'jpeg';
			}
			elseif ($strMime == 'svg')
			{
				$strMime = 'svg+xml';
			}

			// Return the data: string
			if ($objImage->size <= $arrParent['embedImages'])
			{
				return 'data:image/' . $strMime . ';base64,' . base64_encode($objImage->getContent());
			}
		}

		return false;
	}
protected function generateBase64Image($strImage, $arrParent)
	{
		if ($arrParent['embedImages'] > 0 && file_exists($this->strRootDir . '/' . $strImage))
		{
			$objImage = new File($strImage);
			$strMime = $objImage->extension;

			// Adjust the mime types
			if ($strMime == 'jpg')
			{
				$strMime = 'jpeg';
			}
			elseif ($strMime == 'svg')
			{
				$strMime = 'svg+xml';
			}

			// Return the data: string
			if ($objImage->size <= $arrParent['embedImages'])
			{
				return 'data:image/' . $strMime . ';base64,' . base64_encode($objImage->getContent());
			}
		}

		return false;
	}
Return an image as data: string

@param string $strImage
@param array  $arrParent

@return string|boolean