Bitrix API

CFile

Table of Contents

Methods

_GetImgParams()  : mixed
AddVersion()  : mixed
Adds information about a version of a file.
ApplyImageFilter()  : bool
ChangeSubDir()  : mixed
CheckFile()  : mixed
checkForDb()  : mixed
CheckImageFile()  : mixed
CleanCache()  : mixed
CloneFile()  : int|null
ConvertFilesToPost()  : mixed
CopyFile()  : mixed
CreateImage()  : false|resource
Delete()  : mixed
DeleteDuplicates()  : mixed
Adds information about a duplicate file.
DeleteHashAgent()  : mixed
DisableJSFunction()  : mixed
DoInsert()  : mixed
ExtractImageExif()  : array<string|int, mixed>
FindDuplicate()  : EO_FileHash|null
FormatSize()  : string
GetByID()  : mixed
GetContentType()  : mixed
GetFileArray()  : mixed
GetFileSRC()  : mixed
GetFlashExtensions()  : mixed
GetFromCache()  : mixed
GetImageExtensions()  : mixed
GetImageSize()  : array<string|int, mixed>|false
GetList()  : mixed
GetPath()  : string|null
Retuns the path from the root by a file ID.
GetTempName()  : mixed
ImageCreateFromBMP()  : false|resource
ImageFlipHorizontal()  : mixed
ImageHandleOrientation()  : false|resource
ImageRotate()  : bool
Reads an image from a file, rotates it clockwise, and saves it to the same file.
InputFile()  : mixed
IsGD2()  : bool
IsImage()  : mixed
MakeFileArray()  : array<string|int, mixed>|bool|null
Returns an array describing file as if it was $_FILES element.
NormalizeContentType()  : string
OutputJSImgShw()  : mixed
ResizeImage()  : mixed
ResizeImageDelete()  : mixed
ResizeImageDeleteCache()  : mixed
ResizeImageFile()  : mixed
ResizeImageGet()  : mixed
SaveFile()  : mixed
SaveForDB()  : mixed
ScaleImage()  : mixed
Show2Images()  : mixed
ShowFile()  : mixed
ShowImage()  : mixed
UpdateDesc()  : mixed
UpdateExternalId()  : mixed
ViewByUser()  : bool
Watermark()  : array<string|int, mixed>|bool
WatermarkImage()  : bool
Creates watermark from image.
WatermarkText()  : bool

Methods

_GetImgParams()

public static _GetImgParams(mixed $strImage[, mixed $iSizeWHTTP = 0 ][, mixed $iSizeHHTTP = 0 ]) : mixed
Parameters
$strImage : mixed
$iSizeWHTTP : mixed = 0
$iSizeHHTTP : mixed = 0

AddVersion()

Adds information about a version of a file.

public static AddVersion(int $originalId, int $versionId[, array<string|int, mixed> $metaData = [] ]) : mixed
Parameters
$originalId : int

Original file ID.

$versionId : int

Version file ID.

$metaData : array<string|int, mixed> = []

The version peculiarities.

ApplyImageFilter()

public static ApplyImageFilter(mixed $picture, mixed $arFilter) : bool

Use \Bitrix\Main\File\Image

Parameters
$picture : mixed
$arFilter : mixed
Return values
bool

ChangeSubDir()

public static ChangeSubDir(mixed $module_id, mixed $old_subdir, mixed $new_subdir) : mixed
Parameters
$module_id : mixed
$old_subdir : mixed
$new_subdir : mixed

CheckFile()

public static CheckFile(mixed $arFile[, mixed $intMaxSize = 0 ][, mixed $mimeType = false ][, mixed $strExt = false ][, mixed $bForceMD5 = false ][, mixed $bSkipExt = false ]) : mixed
Parameters
$arFile : mixed
$intMaxSize : mixed = 0
$mimeType : mixed = false
$strExt : mixed = false
$bForceMD5 : mixed = false
$bSkipExt : mixed = false

checkForDb()

public static checkForDb(mixed $arFields, mixed $field) : mixed
Parameters
$arFields : mixed
$field : mixed

CheckImageFile()

public static CheckImageFile(mixed $arFile[, mixed $iMaxSize = 0 ][, mixed $iMaxWidth = 0 ][, mixed $iMaxHeight = 0 ][, mixed $access_typies = [] ][, mixed $bForceMD5 = false ][, mixed $bSkipExt = false ]) : mixed
Parameters
$arFile : mixed
$iMaxSize : mixed = 0
$iMaxWidth : mixed = 0
$iMaxHeight : mixed = 0
$access_typies : mixed = []
$bForceMD5 : mixed = false
$bSkipExt : mixed = false

CleanCache()

public static CleanCache(mixed $fileId) : mixed
Parameters
$fileId : mixed

CloneFile()

public static CloneFile(int $fileId) : int|null
Parameters
$fileId : int
Return values
int|null

ConvertFilesToPost()

public static ConvertFilesToPost(mixed $source, mixed &$target[, mixed $field = false ]) : mixed
Parameters
$source : mixed
$target : mixed
$field : mixed = false

CopyFile()

public static CopyFile(mixed $FILE_ID[, mixed $bRegister = true ][, mixed $newPath = "" ]) : mixed

Consider using \CFile::CloneFile().

Parameters
$FILE_ID : mixed
$bRegister : mixed = true
$newPath : mixed = ""
Tags
see
CFile::CloneFile()

CreateImage()

public static CreateImage(string $path) : false|resource

Use \Bitrix\Main\File\Image

Parameters
$path : string
Return values
false|resource

Delete()

public static Delete(mixed $ID) : mixed
Parameters
$ID : mixed

DeleteDuplicates()

Adds information about a duplicate file.

public static DeleteDuplicates(int $originalId, array<string|int, mixed> $duplicteIds) : mixed
Parameters
$originalId : int

Original file ID.

$duplicteIds : array<string|int, mixed>

List of file IDs to delete and update their path to the original file path.

DeleteHashAgent()

public static DeleteHashAgent() : mixed

DisableJSFunction()

public static DisableJSFunction([mixed $b = true ]) : mixed
Parameters
$b : mixed = true

DoInsert()

public static DoInsert(mixed $arFields) : mixed
Parameters
$arFields : mixed

ExtractImageExif()

public static ExtractImageExif(mixed $src) : array<string|int, mixed>

Use \Bitrix\Main\File\Image::getExifData()

Parameters
$src : mixed
Return values
array<string|int, mixed>

FindDuplicate()

public static FindDuplicate(int $size, string $hash[, int|null $handlerId = null ]) : EO_FileHash|null
Parameters
$size : int
$hash : string
$handlerId : int|null = null
Return values
EO_FileHash|null

FormatSize()

public static FormatSize(float $size[, int $precision = 2 ]) : string
Parameters
$size : float
$precision : int = 2
Return values
string

GetByID()

public static GetByID(mixed $fileId[, mixed $realId = false ]) : mixed
Parameters
$fileId : mixed
$realId : mixed = false

GetContentType()

public static GetContentType(mixed $path[, mixed $bPhysicalName = false ]) : mixed
Parameters
$path : mixed
$bPhysicalName : mixed = false

GetFileArray()

public static GetFileArray(mixed $fileId[, mixed $uploadDir = false ]) : mixed
Parameters
$fileId : mixed
$uploadDir : mixed = false

GetFileSRC()

public static GetFileSRC(mixed $file[, mixed $uploadDir = false ][, mixed $external = true ]) : mixed
Parameters
$file : mixed
$uploadDir : mixed = false
$external : mixed = true

GetFlashExtensions()

public static GetFlashExtensions() : mixed

GetFromCache()

public static GetFromCache(mixed $fileId[, mixed $realId = false ]) : mixed
Parameters
$fileId : mixed
$realId : mixed = false

GetImageExtensions()

public static GetImageExtensions() : mixed

GetImageSize()

public static GetImageSize(string $path[, bool $bPhysicalName = false ][, bool $flashEnabled = false ]) : array<string|int, mixed>|false

Use \Bitrix\Main\File\Image::getInfo()

Parameters
$path : string
$bPhysicalName : bool = false
$flashEnabled : bool = false
Return values
array<string|int, mixed>|false

GetList()

public static GetList([mixed $arOrder = [] ][, mixed $arFilter = [] ]) : mixed
Parameters
$arOrder : mixed = []
$arFilter : mixed = []

GetPath()

Retuns the path from the root by a file ID.

public static GetPath(int $img_id) : string|null
Parameters
$img_id : int

File ID

Return values
string|null

GetTempName()

public static GetTempName([mixed $dir_name = false ][, mixed $file_name = '' ]) : mixed
Parameters
$dir_name : mixed = false
$file_name : mixed = ''

ImageCreateFromBMP()

public static ImageCreateFromBMP(mixed $filename) : false|resource

Use imagecreatefrombmp()

Parameters
$filename : mixed
Return values
false|resource

ImageFlipHorizontal()

public static ImageFlipHorizontal(mixed $picture) : mixed

Use \Bitrix\Main\File\Image

Parameters
$picture : mixed

ImageHandleOrientation()

public static ImageHandleOrientation(mixed $orientation, mixed $sourceImage) : false|resource

Use \Bitrix\Main\File\Image::autoRotate()

Parameters
$orientation : mixed
$sourceImage : mixed
Return values
false|resource

ImageRotate()

Reads an image from a file, rotates it clockwise, and saves it to the same file.

public static ImageRotate(string $sourceFile, float $angle) : bool
Parameters
$sourceFile : string
$angle : float
Return values
bool

InputFile()

public static InputFile(mixed $strFieldName, mixed $int_field_size, mixed $strImageID[, mixed $strImageStorePath = false ][, mixed $int_max_file_size = 0 ][, mixed $strFileType = "IMAGE" ][, mixed $field_file = "class=typefile" ][, mixed $description_size = 0 ][, mixed $field_text = "class=typeinput" ][, mixed $field_checkbox = "" ][, mixed $bShowNotes = true ][, mixed $bShowFilePath = true ]) : mixed
Parameters
$strFieldName : mixed
$int_field_size : mixed
$strImageID : mixed
$strImageStorePath : mixed = false
$int_max_file_size : mixed = 0
$strFileType : mixed = "IMAGE"
$field_file : mixed = "class=typefile"
$description_size : mixed = 0
$field_text : mixed = "class=typeinput"
$field_checkbox : mixed = ""
$bShowNotes : mixed = true
$bShowFilePath : mixed = true

IsGD2()

public static IsGD2() : bool

Always returns true.

Return values
bool

IsImage()

public static IsImage(mixed $filename[, mixed $mime_type = false ]) : mixed
Parameters
$filename : mixed
$mime_type : mixed = false

MakeFileArray()

Returns an array describing file as if it was $_FILES element.

public static MakeFileArray(string|int $path[, string|bool $mimetype = false ][, bool $skipInternal = false ][, string $external_id = "" ]) : array<string|int, mixed>|bool|null
Parameters
$path : string|int

May contain ID of the file, absolute path, relative path or an url.

$mimetype : string|bool = false

Forces type field of the array

$skipInternal : bool = false

Excludes using ID as $path

$external_id : string = ""
Return values
array<string|int, mixed>|bool|null

NormalizeContentType()

public static NormalizeContentType(mixed $contentType) : string

Use Web\MimeType::normalize()

Parameters
$contentType : mixed
Return values
string

OutputJSImgShw()

public static OutputJSImgShw() : mixed

ResizeImage()

public static ResizeImage(mixed &$arFile, mixed $arSize[, mixed $resizeType = \BX_RESIZE_IMAGE_PROPORTIONAL ]) : mixed
Parameters
$arFile : mixed
$arSize : mixed
$resizeType : mixed = \BX_RESIZE_IMAGE_PROPORTIONAL

ResizeImageDelete()

public static ResizeImageDelete(mixed $arImage) : mixed
Parameters
$arImage : mixed

ResizeImageDeleteCache()

public static ResizeImageDeleteCache(mixed $arFile) : mixed
Parameters
$arFile : mixed

ResizeImageFile()

public static ResizeImageFile(mixed $sourceFile, mixed $destinationFile, mixed $arSize[, mixed $resizeType = \BX_RESIZE_IMAGE_PROPORTIONAL ][, mixed $arWaterMark = [] ][, mixed $quality = false ][, mixed $arFilters = false ]) : mixed
Parameters
$sourceFile : mixed
$destinationFile : mixed
$arSize : mixed
$resizeType : mixed = \BX_RESIZE_IMAGE_PROPORTIONAL
$arWaterMark : mixed = []
$quality : mixed = false
$arFilters : mixed = false

ResizeImageGet()

public static ResizeImageGet(mixed $file, mixed $arSize[, mixed $resizeType = \BX_RESIZE_IMAGE_PROPORTIONAL ][, mixed $bInitSizes = false ][, mixed $arFilters = false ][, mixed $bImmediate = false ][, mixed $jpgQuality = false ]) : mixed
Parameters
$file : mixed
$arSize : mixed
$resizeType : mixed = \BX_RESIZE_IMAGE_PROPORTIONAL
$bInitSizes : mixed = false
$arFilters : mixed = false
$bImmediate : mixed = false
$jpgQuality : mixed = false

SaveFile()

public static SaveFile(mixed $arFile, mixed $strSavePath[, mixed $forceRandom = false ][, mixed $skipExtension = false ][, mixed $dirAdd = '' ]) : mixed
Parameters
$arFile : mixed
$strSavePath : mixed
$forceRandom : mixed = false
$skipExtension : mixed = false
$dirAdd : mixed = ''

SaveForDB()

public static SaveForDB(mixed &$arFields, mixed $field, mixed $strSavePath) : mixed
Parameters
$arFields : mixed
$field : mixed
$strSavePath : mixed

ScaleImage()

public static ScaleImage(mixed $sourceImageWidth, mixed $sourceImageHeight, mixed $arSize, mixed $resizeType, mixed &$bNeedCreatePicture, mixed &$arSourceSize, mixed &$arDestinationSize) : mixed

Use \Bitrix\Main\File\Image\Rectangle::resize()

Parameters
$sourceImageWidth : mixed
$sourceImageHeight : mixed
$arSize : mixed
$resizeType : mixed
$bNeedCreatePicture : mixed
$arSourceSize : mixed
$arDestinationSize : mixed

Show2Images()

public static Show2Images(mixed $strImage1, mixed $strImage2[, mixed $iMaxW = 0 ][, mixed $iMaxH = 0 ][, mixed $sParams = false ][, mixed $sPopupTitle = false ][, mixed $iSizeWHTTP = 0 ][, mixed $iSizeHHTTP = 0 ]) : mixed
Parameters
$strImage1 : mixed
$strImage2 : mixed
$iMaxW : mixed = 0
$iMaxH : mixed = 0
$sParams : mixed = false
$sPopupTitle : mixed = false
$iSizeWHTTP : mixed = 0
$iSizeHHTTP : mixed = 0

ShowFile()

public static ShowFile(mixed $iFileID[, mixed $max_file_size = 0 ][, mixed $iMaxW = 0 ][, mixed $iMaxH = 0 ][, mixed $bPopup = false ][, mixed $sParams = false ][, mixed $sPopupTitle = false ][, mixed $iSizeWHTTP = 0 ][, mixed $iSizeHHTTP = 0 ]) : mixed
Parameters
$iFileID : mixed
$max_file_size : mixed = 0
$iMaxW : mixed = 0
$iMaxH : mixed = 0
$bPopup : mixed = false
$sParams : mixed = false
$sPopupTitle : mixed = false
$iSizeWHTTP : mixed = 0
$iSizeHHTTP : mixed = 0

ShowImage()

public static ShowImage(mixed $strImage[, mixed $iMaxW = 0 ][, mixed $iMaxH = 0 ][, mixed $sParams = null ][, mixed $strImageUrl = "" ][, mixed $bPopup = false ][, mixed $sPopupTitle = false ][, mixed $iSizeWHTTP = 0 ][, mixed $iSizeHHTTP = 0 ][, mixed $strImageUrlTemplate = "" ]) : mixed
Parameters
$strImage : mixed
$iMaxW : mixed = 0
$iMaxH : mixed = 0
$sParams : mixed = null
$strImageUrl : mixed = ""
$bPopup : mixed = false
$sPopupTitle : mixed = false
$iSizeWHTTP : mixed = 0
$iSizeHHTTP : mixed = 0
$strImageUrlTemplate : mixed = ""

UpdateDesc()

public static UpdateDesc(mixed $ID, mixed $desc) : mixed
Parameters
$ID : mixed
$desc : mixed

UpdateExternalId()

public static UpdateExternalId(mixed $ID, mixed $external_id) : mixed
Parameters
$ID : mixed
$external_id : mixed

ViewByUser()

public static ViewByUser(int|array<string|int, mixed> $arFile[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$arFile : int|array<string|int, mixed>
$options : array<string|int, mixed> = []
Return values
bool

Watermark()

public static Watermark(mixed $obj, mixed $Params) : array<string|int, mixed>|bool

Use \Bitrix\Main\File\Image.

Parameters
$obj : mixed
$Params : mixed

type - text|image size - big|medium|small|real, for custom resizing can be used 'coefficient', real - only for images position - of the watermark on picture can be in one of two available notifications: tl|tc|tr|ml|mc|mr|bl|bc|br or topleft|topcenter|topright|centerleft|center|centerright|bottomleft|bottomcenter|bottomright

Return values
array<string|int, mixed>|bool

WatermarkImage()

Creates watermark from image.

public static WatermarkImage(mixed $obj[, array<string|int, mixed> $Params = [] ]) : bool

Use \Bitrix\Main\File\Image::drawWatermark()

Parameters
$obj : mixed
$Params : array<string|int, mixed> = []

file - abs path to file alpha_level - opacity position - of the watermark

Return values
bool

WatermarkText()

public static WatermarkText(mixed $obj[, array<string|int, mixed> $Params = [] ]) : bool

Use \Bitrix\Main\File\Image::drawWatermark()

Parameters
$obj : mixed
$Params : array<string|int, mixed> = []
Return values
bool

        
On this page

Search results