- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/vcard/vcardfile.php
- Класс: Bitrix\Crm\VCard\VCardFile
- Вызов: VCardFile::getFileInfo
public function getFileInfo()
{
$fileInfo = null;
if($this->encoding === 'B' || $this->encoding === 'BASE64')
{
$type = $this->type !== ''? mb_strtolower($this->type) : 'jpg';
if($type === '' || !in_array($type, explode(',', \CFile::GetImageExtensions()), true))
{
$type = 'jpg';
}
$filePath = \CTempFile::GetFileName(uniqid('vcard_img').'.'.$type);
CheckDirPath($filePath);
//Removing of line folding
$encodedData = preg_replace("/\\\\n/i", "\n", $this->value);
if(file_put_contents($filePath, base64_decode($encodedData)) !== false)
{
$fileInfo = \CFile::MakeFileArray($filePath, "image/{$type}");
}
}
elseif($this->valueType === 'URI'
&& \CCrmUrlUtil::HasScheme($this->value) && \CCrmUrlUtil::IsSecureUrl($this->value))
{
$fileInfo = \CFile::MakeFileArray($this->value);
}
return is_array($fileInfo) && \CFile::CheckImageFile($fileInfo) == ''
? $fileInfo : null;
}