本文整理汇总了PHP中CFile::GetFileArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::GetFileArray方法的具体用法?PHP CFile::GetFileArray怎么用?PHP CFile::GetFileArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetFileArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chooseFileIcoClass
/**
* Choose picture dependence on type
*/
public function chooseFileIcoClass($id)
{
$fileInfo = \CFile::GetFileArray($id);
if ($fileInfo["CONTENT_TYPE"] == PDF)
{
return "ico_pdf";
}
elseif ($fileInfo["CONTENT_TYPE"] == DOC)
{
return "ico_doc";
}
elseif ($fileInfo["CONTENT_TYPE"] == JPG)
{
return "ico_jpg";
}
elseif ($fileInfo["CONTENT_TYPE"] == ZIP)
{
return "ico_zip";
}
else
{
return "ico_cd";
}
throw new \Exception("An error wa occured in " . __CLASS__, 1);
}
示例2: __MPF_ImageResizeHandler
function __MPF_ImageResizeHandler(&$arCustomFile, $params = array(), $result = array())
{
static $arParams = array();
if (!empty($params)) {
$arParams = $params;
}
static $arResult = array();
if (!empty($result)) {
$arResult = $result;
}
$fileIdForDelete = 0;
$arFields = array();
foreach (array("MELODY_WELCOME", "MELODY_WAIT", "MELODY_HOLD", "MELODY_VOICEMAIL") as $controlID => $inputName) {
if ($_REQUEST["controlID"] == "voximplant" . $controlID) {
$fileIdForDelete = $arResult["ITEM"][$inputName];
$arFields = array($inputName => $arCustomFile["fileID"]);
break;
}
}
if (!empty($arFields)) {
$arFile = CFile::GetFileArray($arCustomFile['fileID']);
$arCustomFile["fileURL"] = CHTTP::URN2URI($arFile["SRC"]);
Bitrix\Voximplant\ConfigTable::update($arParams["ID"], $arFields);
CFile::Delete($fileIdForDelete);
}
}
示例3: __CSVExportFile
function __CSVExportFile($intFileID, $strExportPath, $strFilePath, $strExportFromClouds = 'Y')
{
if ('Y' != $strExportFromClouds)
$strExportFromClouds = 'N';
$arFile = CFile::GetFileArray($intFileID);
if ($arFile)
{
if ('N' == $strExportFromClouds && 0 < $arFile["HANDLER_ID"])
{
return serialize($arFile);
}
else
{
$arTempFile = CFile::MakeFileArray($intFileID);
if (isset($arTempFile["tmp_name"]) && $arTempFile["tmp_name"] != "")
{
$strFile = $arFile["SUBDIR"]."/".$arFile["FILE_NAME"];
$strNewFile = str_replace("//", "/", $strExportPath.$strFilePath.$strFile);
CheckDirPath($_SERVER['DOCUMENT_ROOT'].$strNewFile);
if (@copy($arTempFile["tmp_name"], $_SERVER['DOCUMENT_ROOT'].$strNewFile))
return $strFilePath.$strFile;
}
}
}
return '';
}
示例4: GetResizedImage
function GetResizedImage($id, $width, $height)
{
$arSize = array("width" => $width, "height" => $height);
$file = CFile::GetFileArray($id);
$resized = CFile::ResizeImageGet($file, $arSize);
return $resized;
}
示例5: getProductInfo
/** Returns an array, containing information about the product block on its ID.
* @param $elementId
* @return array|string
*/
public static function getProductInfo($elementId)
{
$elementId = intval($elementId);
$result = "";
if ($elementId <= 0) {
return $result;
}
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $elementId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'NAME', 'XML_ID'));
while ($arProduct = $dbProduct->GetNext()) {
$imgCode = "";
if ($arProduct["IBLOCK_ID"] > 0) {
$arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $elementId, array("find_section_section" => $arProduct["IBLOCK_SECTION_ID"]));
}
if ($arProduct["DETAIL_PICTURE"] > 0) {
$imgCode = $arProduct["DETAIL_PICTURE"];
} elseif ($arProduct["PREVIEW_PICTURE"] > 0) {
$imgCode = $arProduct["PREVIEW_PICTURE"];
}
$arProduct["NAME"] = $arProduct["NAME"];
$arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]);
if ($imgCode > 0) {
$arFile = CFile::GetFileArray($imgCode);
$arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
$arProduct["IMG_URL"] = $arImgProduct['src'];
}
return $arProduct;
}
return $result;
}
示例6: getInfo
/**
* Возвращаем данные столика
* @param $arData
* @return CDBResult|CIBlockResult|string
*/
function getInfo($tableID, $arData = false, $GetNext = false)
{
$arFilterTable = array("IBLOCK_ID" => IB_TABLE_ID, "PROPERTY_CLUB" => $this->clubID, "ID" => intval($tableID));
$arSelectTable = array("ID");
$arOrderTable = array();
$arOrder = is_array($arData["arSelect"]) ? array_merge($arData["arOrder"], $arOrderTable) : $arOrderTable;
$arGroupBy = is_array($arData["arGroupBy"]) ? array_merge($arData["arGroupBy"], array()) : false;
$arNavStartParams = is_array($arData["arGroupBy"]) ? array_merge($arData["arNavStartParams"], array()) : false;
$arSelect = is_array($arData["arSelect"]) ? array_merge($arData["arSelect"], $arSelectTable) : $arSelectTable;
$arFilter = is_array($arData["arFilter"]) ? array_merge($arData["arFilter"], $arFilterTable) : $arFilterTable;
$res = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelect);
if (!$res) {
return Errors::run("404");
}
$ob = $GetNext ? $res->GetNext() : $res->Fetch();
if (isset($ob["PREVIEW_PICTURE"])) {
$arFile = CFile::GetFileArray($ob["PREVIEW_PICTURE"]);
$ob["PREVIEW_PICTURE"] = $arFile["SRC"];
}
if (isset($ob["PROPERTY_PRICE_GROUP_VALUE"])) {
$res = CIBlockElement::GetList(array(), array("ID" => intval($ob["PROPERTY_PRICE_GROUP_VALUE"]), "IBLOCK_ID" => IB_PRICE_GROUP), false, false, array("NAME", "ID", "PROPERTY_PRICE"));
$ob["PROPERTY_PRICE_GROUP"] = $res->Fetch();
}
return $ob;
}
示例7: getFileInfo
private function getFileInfo($file)
{
switch (true) {
case !$file:
return false;
break;
case is_array($file):
$path_parts = pathinfo($file["name"]);
$ext = $path_parts['extension'];
$fileName = $file["tmp_name"];
break;
case file_exists($file):
$path_parts = pathinfo($file);
$ext = $path_parts['extension'];
$fileName = $file;
break;
case is_numeric($file):
$file_info = CFile::GetFileArray($file);
if (is_array($file_info)) {
return $this->getFileInfo($_SERVER['DOCUMENT_ROOT'] . $file_info['SRC']);
}
break;
default:
$path_parts = pathinfo($file);
$fileName = ini_get('upload_tmp_dir') . '/' . $path_parts["basename"];
file_put_contents($fileName, file_get_contents($file));
return $this->getFileInfo($fileName);
break;
}
$ext = strtolower($ext);
return array('FILE_NAME' => $fileName, 'EXT' => $ext);
}
示例8: getProductInfo
function getProductInfo($arData)
{
$result = "";
if (!is_array($arData) || count($arData) <= 0) {
return $result;
}
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $arData["ELEMENT_ID"]), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'IBLOCK_TYPE_ID', 'NAME'));
while ($arProduct = $dbProduct->GetNext()) {
$imgCode = "";
if ($arProduct["IBLOCK_ID"] > 0) {
$arProduct["EDIT_PAGE_URL"] = "/bitrix/admin/iblock_element_edit.php?ID=" . $arProduct["ID"] . "&type=" . $arProduct["IBLOCK_TYPE_ID"] . "&lang=" . LANG . "&IBLOCK_ID=" . $arProduct["IBLOCK_ID"] . "&find_section_section=" . intval($arProduct["IBLOCK_SECTION_ID"]);
}
if ($arProduct["DETAIL_PICTURE"] > 0) {
$imgCode = $arProduct["DETAIL_PICTURE"];
} elseif ($arProduct["PREVIEW_PICTURE"] > 0) {
$imgCode = $arProduct["PREVIEW_PICTURE"];
}
$arProduct["NAME"] = htmlspecialcharsex($arProduct["NAME"]);
$arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]);
$arProduct["CURRENCY"] = htmlspecialcharsex($arProduct["CURRENCY"]);
if ($imgCode > 0) {
$arFile = CFile::GetFileArray($imgCode);
$arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
$arProduct["IMG_URL"] = $arImgProduct['src'];
}
return $arProduct;
}
}
示例9: getDoublePicturesForItem
function getDoublePicturesForItem(&$item, $propertyCode)
{
$result = array('PICT' => false, 'SECOND_PICT' => false);
if (!empty($item) && is_array($item)) {
if (!empty($item['PREVIEW_PICTURE'])) {
if (!is_array($item['PREVIEW_PICTURE'])) {
$item['PREVIEW_PICTURE'] = CFile::GetFileArray($item['PREVIEW_PICTURE']);
}
if (isset($item['PREVIEW_PICTURE']['ID'])) {
$result['PICT'] = array('ID' => intval($item['PREVIEW_PICTURE']['ID']), 'SRC' => $item['PREVIEW_PICTURE']['SRC'], 'WIDTH' => intval($item['PREVIEW_PICTURE']['WIDTH']), 'HEIGHT' => intval($item['PREVIEW_PICTURE']['HEIGHT']));
}
}
if (!empty($item['DETAIL_PICTURE'])) {
$keyPict = empty($result['PICT']) ? 'PICT' : 'SECOND_PICT';
if (!is_array($item['DETAIL_PICTURE'])) {
$item['DETAIL_PICTURE'] = CFile::GetFileArray($item['DETAIL_PICTURE']);
}
if (isset($item['DETAIL_PICTURE']['ID'])) {
$result[$keyPict] = array('ID' => intval($item['DETAIL_PICTURE']['ID']), 'SRC' => $item['DETAIL_PICTURE']['SRC'], 'WIDTH' => intval($item['DETAIL_PICTURE']['WIDTH']), 'HEIGHT' => intval($item['DETAIL_PICTURE']['HEIGHT']));
}
}
if (empty($result['SECOND_PICT'])) {
if ('' != $propertyCode && isset($item['PROPERTIES'][$propertyCode]) && 'F' == $item['PROPERTIES'][$propertyCode]['PROPERTY_TYPE']) {
if (isset($item['DISPLAY_PROPERTIES'][$propertyCode]['FILE_VALUE']) && !empty($item['DISPLAY_PROPERTIES'][$propertyCode]['FILE_VALUE'])) {
$fileValues = isset($item['DISPLAY_PROPERTIES'][$propertyCode]['FILE_VALUE']['ID']) ? array(0 => $item['DISPLAY_PROPERTIES'][$propertyCode]['FILE_VALUE']) : $item['DISPLAY_PROPERTIES'][$propertyCode]['FILE_VALUE'];
foreach ($fileValues as &$oneFileValue) {
$keyPict = empty($result['PICT']) ? 'PICT' : 'SECOND_PICT';
$result[$keyPict] = array('ID' => intval($oneFileValue['ID']), 'SRC' => $oneFileValue['SRC'], 'WIDTH' => intval($oneFileValue['WIDTH']), 'HEIGHT' => intval($oneFileValue['HEIGHT']));
if ('SECOND_PICT' == $keyPict) {
break;
}
}
if (isset($oneFileValue)) {
unset($oneFileValue);
}
} else {
$propValues = $item['PROPERTIES'][$propertyCode]['VALUE'];
if (!is_array($propValues)) {
$propValues = array($propValues);
}
foreach ($propValues as &$oneValue) {
$oneFileValue = CFile::GetFileArray($oneValue);
if (isset($oneFileValue['ID'])) {
$keyPict = empty($result['PICT']) ? 'PICT' : 'SECOND_PICT';
$result[$keyPict] = array('ID' => intval($oneFileValue['ID']), 'SRC' => $oneFileValue['SRC'], 'WIDTH' => intval($oneFileValue['WIDTH']), 'HEIGHT' => intval($oneFileValue['HEIGHT']));
if ('SECOND_PICT' == $keyPict) {
break;
}
}
}
if (isset($oneValue)) {
unset($oneValue);
}
}
}
}
}
return $result;
}
示例10: __construct
function __construct($file)
{
if (is_int($file)) {
$file = CFile::GetFileArray($file);
}
$this->file = $file;
$this->path_parts = pathinfo($this->file['SRC']);
}
示例11: getFileArray
/**
* Возвращает массив с описанием файла
* @return string
*/
public function getFileArray()
{
$val = $this->getValue();
if ($val && $this->_fileArray === null && is_numeric($val)) {
$this->_fileArray = \CFile::GetFileArray($val);
}
return $this->_fileArray;
}
示例12: waterImage
/**
* [waterImage description]
* @param int $imgId
* @return array
*/
function waterImage($imgId)
{
$arFile = CFile::GetFileArray($imgId);
$arFilters = array(array("name" => "watermark", "position" => "bottomleft", "size" => "real", "alpha_level" => "50", "file" => $_SERVER['DOCUMENT_ROOT'] . "/img/watermark.png"));
$width = $arFile["WIDTH"];
$height = $arFile["HEIGHT"];
$resultImage = CFile::ResizeImageGet($arFile, array('width' => $width, 'height' => $height), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilters);
return $resultImage;
}
示例13: __construct
function __construct($element_id, $field_id, $file_id)
{
$this->_element_id = intval($element_id);
$this->_field_id = $field_id;
$this->_file_id = intval($file_id);
$this->_file = CFile::GetFileArray($this->_file_id);
if (is_array($this->_file)) {
$this->_width = intval($this->_file['WIDTH']);
$this->_height = intval($this->_file['HEIGHT']);
}
}
示例14: group2JSItem
function group2JSItem($arGroup, $fieldPrevix = "")
{
$arGroupTmp = array("ID" => $arGroup[$fieldPrevix . "ID"], "id" => $arGroup[$fieldPrevix . "ID"], "title" => $arGroup[$fieldPrevix . "NAME"], "description" => $arGroup[$fieldPrevix . "DESCRIPTION"]);
if ($arGroup[$fieldPrevix . "IMAGE_ID"]) {
$imageFile = CFile::GetFileArray($arGroup[$fieldPrevix . "IMAGE_ID"]);
if ($imageFile !== false) {
$arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$arGroupTmp["image"] = $arFileTmp["src"];
}
}
return $arGroupTmp;
}
示例15: __MPF_ImageResizeHandler
function __MPF_ImageResizeHandler(&$arCustomFile, $arParams = null)
{
static $arResizeParams = array();
if ($arParams !== null)
{
if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams))
{
$arResizeParams = $arParams;
}
elseif(intVal($arParams) > 0)
{
$arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams));
}
}
if ((!is_array($arCustomFile)) || !isset($arCustomFile['fileID']))
return false;
$fileID = $arCustomFile['fileID'];
if (!isset($arCustomFile['fileContentType']))
{
$arFile = CFile::GetFileArray($fileID);
$arCustomFile['fileContentType'] = $arFile['CONTENT_TYPE'];
$arCustomFile["fileSrc"] = $arFile["SRC"];
}
if (strpos($arCustomFile['fileContentType'], 'image/') === 0)
{
$aImgThumb = CFile::ResizeImageGet(
$fileID,
array("width" => 90, "height" => 90),
BX_RESIZE_IMAGE_EXACT,
true
);
$arCustomFile['img_thumb_src'] = $aImgThumb['src'];
if (!empty($arResizeParams))
{
$aImgSource = CFile::ResizeImageGet(
$fileID,
array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]),
BX_RESIZE_IMAGE_PROPORTIONAL,
true
);
$arCustomFile['img_source_src'] = $aImgSource['src'];
$arCustomFile['img_source_width'] = $aImgSource['width'];
$arCustomFile['img_source_height'] = $aImgSource['height'];
}
}
}