当前位置: 首页>>代码示例>>PHP>>正文


PHP CFile::IsImage方法代码示例

本文整理汇总了PHP中CFile::IsImage方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::IsImage方法的具体用法?PHP CFile::IsImage怎么用?PHP CFile::IsImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFile的用法示例。


在下文中一共展示了CFile::IsImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forumCommentsCommentWeb

function forumCommentsCommentWeb(array $comment, array $arParams, array $arResult, ForumCommentsComponent $component)
{
    global $APPLICATION;
    $arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58;
    $res = array("ID" => $comment["ID"], "NEW" => $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["APPROVED"], "POST_TIMESTAMP" => $comment["POST_TIMESTAMP"], "AUTHOR" => array("ID" => $comment["AUTHOR_ID"], "NAME" => $comment["~NAME"], "LAST_NAME" => $comment["~LAST_NAME"], "SECOND_NAME" => $comment["~SECOND_NAME"], "AVATAR" => $comment["AVATAR"] && $comment["AVATAR"]["FILE"] ? $comment["AVATAR"]["FILE"]['src'] : ""), "FILES" => $comment["FILES"], "UF" => $comment["PROPS"], "POST_MESSAGE_TEXT" => $comment["POST_MESSAGE_TEXT"], "~POST_MESSAGE_TEXT" => $comment["~POST_MESSAGE_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => "");
    if (!empty($res["FILES"])) {
        foreach ($res["FILES"] as $key => $file) {
            $res["FILES"][$key]["URL"] = "/bitrix/components/bitrix/forum.interface/show_file.php?fid=" . $file["ID"];
            if (CFile::IsImage($file["SRC"], $file["CONTENT_TYPE"])) {
                $res["FILES"][$key]["THUMBNAIL"] = "/bitrix/components/bitrix/forum.interface/show_file.php?fid=" . $file["ID"] . "&width=90&height=90";
                $res["FILES"][$key]["SRC"] = "/bitrix/components/bitrix/forum.interface/show_file.php?fid=" . $file["ID"];
            }
        }
    }
    return $res;
}
开发者ID:Satariall,项目名称:izurit,代码行数:16,代码来源:functions.php

示例2: RenderFiles

 public static function RenderFiles($fileIDs, $fileUrlTemplate = '', $fileMaxWidth = 0, $fileMaxHeight = 0)
 {
     if (!is_array($fileIDs)) {
         return 0;
     }
     $fileUrlTemplate = strval($fileUrlTemplate);
     $fileMaxWidth = intval($fileMaxWidth);
     if ($fileMaxWidth <= 0) {
         $fileMaxWidth = 350;
     }
     $fileMaxHeight = intval($fileMaxHeight);
     if ($fileMaxHeight <= 350) {
         $fileMaxHeight = 350;
     }
     $file = new CFile();
     $processed = 0;
     foreach ($fileIDs as $fileID) {
         $fileInfo = $file->GetFileArray($fileID);
         if (!is_array($fileInfo)) {
             continue;
         }
         if ($processed > 0) {
             echo '<span class="bx-br-separator"><br/></span>';
         }
         echo '<span class="fields files">';
         $fileInfo['name'] = $fileInfo['ORIGINAL_NAME'];
         if ($file->IsImage($fileInfo['ORIGINAL_NAME'], $fileInfo['CONTENT_TYPE'])) {
             echo $file->ShowImage($fileInfo, $fileMaxWidth, $fileMaxHeight, '', '', true, false, 0, 0, $fileUrlTemplate);
         } else {
             echo '<span class="crm-entity-file-info"><a target="_blank" class="crm-entity-file-link" href="', htmlspecialcharsbx(CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('file_id' => $fileInfo['ID']))), '">', htmlspecialcharsbx($fileInfo['ORIGINAL_NAME']) . '</a><span class="crm-entity-file-size">', CFile::FormatSize($fileInfo['FILE_SIZE']) . '</span></span>';
         }
         echo '</span>';
         $processed++;
     }
     return $processed;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:crm_view_helper.php

示例3: AddMessage


//.........这里部分代码省略.........
         if (is_set($arFields, "HIDDEN")) {
             $hidden = $arFields["HIDDEN"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_HIDDEN")) {
             $hidden = $arFields["IS_HIDDEN"] == "Y" ? "Y" : "N";
         }
         $hidden = $hidden == "Y" ? "Y" : "N";
         $notChangeStatus = is_set($arFields, "NOT_CHANGE_STATUS") && $arFields["NOT_CHANGE_STATUS"] == "Y" ? "Y" : "N";
         $changeLastMessageDate = true;
         if ($arTicket["LAST_MESSAGE_USER_ID"] == $uid && $arTicket["REOPEN"] != "Y") {
             $changeLastMessageDate = false;
         }
         $TASK_TIME = intval($arFields["TASK_TIME"]) > 0 ? intval($arFields["TASK_TIME"]) : "null";
         if (is_set($arFields, "LOG")) {
             $log = $arFields["LOG"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_LOG")) {
             $log = $arFields["IS_LOG"] == "Y" ? "Y" : "N";
         }
         $log = $log == "Y" ? "Y" : "N";
         if (is_set($arFields, "OVERDUE")) {
             $overdue = $arFields["OVERDUE"] == "Y" ? "Y" : "N";
         } elseif (is_set($arFields, "IS_OVERDUE")) {
             $overdue = $arFields["IS_OVERDUE"] == "Y" ? "Y" : "N";
         }
         $overdue = $overdue == "Y" ? "Y" : "N";
         $arFieldsI = array("TIMESTAMP_X" => $DB->GetNowFunction(), "DAY_CREATE" => $DB->CurrentDateFunction(), "C_NUMBER" => $maxNumber + 1, "TICKET_ID" => $ticketID, "IS_HIDDEN" => "'" . $hidden . "'", "IS_LOG" => "'" . $log . "'", "IS_OVERDUE" => "'" . $overdue . "'", "MESSAGE" => "'" . $DB->ForSql($arFields["MESSAGE"]) . "'", "MESSAGE_SEARCH" => "'" . $DB->ForSql(ToUpper($arFields["MESSAGE"])) . "'", "EXTERNAL_ID" => $externalID, "EXTERNAL_FIELD_1" => strlen($externalField1) > 0 ? "'" . $DB->ForSql($externalField1) . "'" : "null", "OWNER_USER_ID" => $ownerUserID, "OWNER_GUEST_ID" => $ownerGuestID, "OWNER_SID" => $ownerSid, "SOURCE_ID" => intval($arFields["MESSAGE_SOURCE_ID"]), "CREATED_USER_ID" => $createdUserID, "CREATED_GUEST_ID" => $createdGuestID, "CREATED_MODULE_NAME" => $createdModuleName, "MODIFIED_USER_ID" => $createdUserID, "MODIFIED_GUEST_ID" => $createdGuestID, "MESSAGE_BY_SUPPORT_TEAM" => $MessageBySupportTeam, "TASK_TIME" => $TASK_TIME, "NOT_CHANGE_STATUS" => "'" . $notChangeStatus . "'");
         CTimeZone::Disable();
         $arFieldsI["DATE_CREATE"] = $DB->CharToDateFunction(GetTime(time(), "FULL"));
         CTimeZone::Enable();
         if ($hidden != "Y" && $log != "Y" && $changeLastMessageDate == false) {
             if ($MessageBySupportTeam == "'Y'" || $maxNumber <= 0 && array_key_exists('SOURCE_SID', $arFields) && $arFields['SOURCE_SID'] === 'email') {
                 $arFieldsI["NOT_CHANGE_STATUS"] = "'N'";
             } else {
                 $arFieldsI["NOT_CHANGE_STATUS"] = "'Y'";
             }
         }
         if (intval($currentResponsibleUserID) > 0) {
             $arFieldsI["CURRENT_RESPONSIBLE_USER_ID"] = $currentResponsibleUserID;
         }
         $mid = $DB->Insert("b_ticket_message", $arFieldsI, $err_mess . __LINE__);
         if (intval($mid) > 0) {
             $not_image_extension_suffix = COption::GetOptionString("support", "NOT_IMAGE_EXTENSION_SUFFIX");
             $not_image_upload_dir = COption::GetOptionString("support", "NOT_IMAGE_UPLOAD_DIR");
             $max_size = COption::GetOptionString("support", "SUPPORT_MAX_FILESIZE");
             // сохраняем приаттаченные файлы
             $arFILES = $arFields["FILES"];
             if (is_array($arFILES) && count($arFILES) > 0) {
                 while (list($key, $arFILE) = each($arFILES)) {
                     if (strlen($arFILE["name"]) > 0) {
                         if ($bSupportTeam != "Y" && $bAdmin != "Y") {
                             $max_file_size = intval($max_size) * 1024;
                         }
                         $fes = "";
                         $upload_dir = "support";
                         if (!CFile::IsImage($arFILE["name"], $arFILE["type"])) {
                             $fes = $not_image_extension_suffix;
                             $arFILE["name"] .= $fes;
                             $upload_dir = $not_image_upload_dir;
                         }
                         if (!array_key_exists("MODULE_ID", $arFILE) || strlen($arFILE["MODULE_ID"]) <= 0) {
                             $arFILE["MODULE_ID"] = "support";
                         }
                         $fid = intval(CFile::SaveFile($arFILE, $upload_dir, $max_file_size));
                         if ($fid > 0) {
                             $md5 = md5(uniqid(mt_rand(), true) . time());
                             $arFILE["HASH"] = $md5;
                             $arFILE["FILE_ID"] = $fid;
                             $arFILE["MESSAGE_ID"] = $mid;
                             $arFILE["TICKET_ID"] = $ticketID;
                             $arFILE["EXTENSION_SUFFIX"] = $fes;
                             $arFields_fi = array("HASH" => "'" . $DB->ForSql($md5, 255) . "'", "MESSAGE_ID" => $mid, "FILE_ID" => $fid, "TICKET_ID" => $ticketID, "EXTENSION_SUFFIX" => strlen($fes) > 0 ? "'" . $DB->ForSql($fes, 255) . "'" : "null");
                             $link_id = $DB->Insert("b_ticket_message_2_file", $arFields_fi, $err_mess . __LINE__);
                             if (intval($link_id) > 0) {
                                 $arFILE["LINK_ID"] = $link_id;
                                 $arrFILES[] = $arFILE;
                             }
                         }
                     }
                 }
             }
             // если это не было скрытым сообщением или сообщение лога, то
             if ($notChangeStatus != "Y" && $hidden != "Y" && $log != "Y") {
                 // обновим ряд параметров обращения
                 if (!isset($arFields["AUTO_CLOSE_DAYS"])) {
                     $RESET_AUTO_CLOSE = "Y";
                 }
                 CTicket::UpdateLastParams($ticketID, $RESET_AUTO_CLOSE, $changeLastMessageDate, true);
                 // при необходимости создадим или удалим агенты-напоминальщики
                 //CTicketReminder::Update($ticketID);
             }
             if ($log != "Y") {
                 CSupportSearch::writeWordsInTable($mid, $siteID, $tTitle . " " . $arFields["MESSAGE"]);
             }
             //если была установлена галочка "не изменять статус обращени" - пересчитаем количество собщений
             if ($notChangeStatus == "Y" || $hidden == "Y") {
                 CTicket::UpdateMessages($ticketID);
             }
         }
     }
     return $mid;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:support.php

示例4: getUFForPostForm

 public static function getUFForPostForm($arParams)
 {
     $arFileData = array();
     $arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], LANGUAGE_ID);
     $ufCode = $arParams["UF_CODE"];
     if (!empty($arUF[$ufCode]) && !empty($arUF[$ufCode]["VALUE"])) {
         if ($arParams["IS_DISK_OR_WEBDAV_INSTALLED"]) {
             if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::IncludeModule('disk')) {
                 $userFieldManager = \Bitrix\Disk\Driver::getInstance()->getUserFieldManager();
                 $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
                 $userFieldManager->loadBatchAttachedObject($arUF[$ufCode]["VALUE"]);
                 foreach ($arUF[$ufCode]["VALUE"] as $attachedId) {
                     $attachedObject = $userFieldManager->getAttachedObjectById($attachedId);
                     if ($attachedObject) {
                         $file = $attachedObject->getObject();
                         $fileName = $file->getName();
                         $fileUrl = $urlManager->getUrlUfController('download', array('attachedId' => $attachedId));
                         $fileUrl = str_replace("/bitrix/tools/disk/uf.php", SITE_DIR . "mobile/ajax.php", $fileUrl);
                         $fileUrl = $fileUrl . (strpos($fileUrl, "?") === false ? "?" : "&") . "mobile_action=disk_uf_view&filename=" . $fileName;
                         if (\Bitrix\Disk\TypeFile::isImage($file) && ($realFile = $file->getFile())) {
                             $previewImageUrl = $urlManager->getUrlUfController('show', array('attachedId' => $attachedId, 'width' => 144, 'height' => 144, 'exact' => 'Y', 'signature' => \Bitrix\Disk\Security\ParameterSigner::getImageSignature($attachedId, 144, 144)));
                         } else {
                             $previewImageUrl = false;
                         }
                         $icon = CMobileHelper::mobileDiskGetIconByFilename($fileName);
                         $iconUrl = CComponentEngine::makePathFromTemplate('/bitrix/components/bitrix/mobile.disk.file.detail/images/' . $icon);
                         $fileFata = array('type' => $file->getExtension(), 'ufCode' => $ufCode, 'id' => $attachedId, 'extension' => $file->getExtension(), 'name' => $fileName, 'url' => $fileUrl, 'iconUrl' => $iconUrl);
                         if ($previewImageUrl) {
                             $fileFata['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
                         }
                         $arFileData[] = $fileFata;
                     }
                 }
             } else {
                 $data = CWebDavIblock::getRootSectionDataForUser($GLOBALS["USER"]->GetID());
                 if (is_array($data)) {
                     $ibe = new CIBlockElement();
                     $dbWDFile = $ibe->GetList(array(), array('ID' => $arUF[$ufCode]["VALUE"], 'IBLOCK_ID' => $data["IBLOCK_ID"]), false, false, array('ID', 'IBLOCK_ID', 'PROPERTY_FILE'));
                     while ($arWDFile = $dbWDFile->Fetch()) {
                         if ($arFile = CFile::GetFileArray($arWDFile["PROPERTY_FILE_VALUE"])) {
                             if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                                 $imageResized = CFile::ResizeImageGet($arFile["ID"], array("width" => 144, "height" => 144), BX_RESIZE_IMAGE_EXACT, false, true);
                                 $previewImageUrl = $imageResized["src"];
                             } else {
                                 $previewImageUrl = false;
                             }
                             $fileExtension = GetFileExtension($arFile["FILE_NAME"]);
                             $fileData = array('type' => $fileExtension, 'ufCode' => $ufCode, 'id' => $arWDFile["ID"], 'extension' => $fileExtension, 'name' => $arFile["FILE_NAME"], 'url' => $arFile["SRC"]);
                             if ($previewImageUrl) {
                                 $fileData['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
                             }
                             $arFileData[] = $fileData;
                         }
                     }
                 }
             }
         } else {
             $dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arUF[$ufCode]["VALUE"])));
             while ($arFile = $dbRes->GetNext()) {
                 if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                     $imageResized = CFile::ResizeImageGet($arFile["ID"], array("width" => 144, "height" => 144), BX_RESIZE_IMAGE_EXACT, false, true);
                     $previewImageUrl = $imageResized["src"];
                 } else {
                     $previewImageUrl = false;
                 }
                 $fileExtension = GetFileExtension($arFile["FILE_NAME"]);
                 $fileData = array('type' => $fileExtension, 'ufCode' => $ufCode, 'id' => $arFile["ID"], 'extension' => $fileExtension, 'name' => $arFile["FILE_NAME"], 'downloadUrl' => $arFile["SRC"]);
                 if ($previewImageUrl) {
                     $fileData['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
                 }
                 $arFileData[] = $fileData;
             }
         }
     }
     return $arFileData;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:76,代码来源:mobile_helper.php

示例5: array

     // process element property files
     $arResult["ELEMENT_FILES"] = array();
     foreach ($arResult["PROPERTY_LIST"] as $propertyID) {
         $arProperty = $arResult["PROPERTY_LIST_FULL"][$propertyID];
         if ($arProperty["PROPERTY_TYPE"] == "F") {
             $arValues = array();
             if (intval($propertyID) > 0) {
                 foreach ($arResult["ELEMENT_PROPERTIES"][$propertyID] as $arProperty) {
                     $arValues[] = $arProperty["VALUE"];
                 }
             } else {
                 $arValues[] = $arResult["ELEMENT"][$propertyID];
             }
             foreach ($arValues as $value) {
                 if ($arFile = CFile::GetFileArray($value)) {
                     $arFile["IS_IMAGE"] = CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"]);
                     $arResult["ELEMENT_FILES"][$value] = $arFile;
                 }
             }
         }
     }
     $bShowForm = true;
 } else {
     $bShowForm = true;
 }
 if ($bShowForm) {
     // prepare form data if some errors occured
     if (count($arResult["ERRORS"]) > 0) {
         //echo "<pre>",htmlspecialcharsbx(print_r($arUpdateValues, true)),"</pre>";
         foreach ($arUpdateValues as $key => $value) {
             if ($key == "IBLOCK_SECTION") {
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例6: OnFileSave


//.........这里部分代码省略.........
         return false;
     }
     $copySize = false;
     $subDir = "";
     $filePath = "";
     if (array_key_exists("content", $arFile)) {
         $arFile["tmp_name"] = CTempFile::GetFileName($arFile["name"]);
         CheckDirPath($arFile["tmp_name"]);
         $fp = fopen($arFile["tmp_name"], "ab");
         if ($fp) {
             fwrite($fp, $arFile["content"]);
             fclose($fp);
         }
     }
     if (array_key_exists("bucket", $arFile)) {
         $newName = bx_basename($arFile["tmp_name"]);
         $prefix = $bucket->GetFileSRC("/");
         $subDir = substr($arFile["tmp_name"], strlen($prefix));
         $subDir = substr($subDir, 0, -strlen($newName) - 1);
     } else {
         if ($bForceMD5 != true && COption::GetOptionString("main", "save_original_file_name", "N") == "Y") {
             if (COption::GetOptionString("main", "convert_original_file_name", "Y") == "Y") {
                 $newName = CCloudStorage::translit($strFileName);
             } else {
                 $newName = $strFileName;
             }
         } else {
             $strFileExt = $bSkipExt == true ? '' : strrchr($strFileName, ".");
             $newName = md5(uniqid(mt_rand(), true)) . $strFileExt;
         }
         //check for double extension vulnerability
         $newName = RemoveScriptExtension($newName);
         while (true) {
             $strRand = md5(mt_rand());
             $strRand = substr($strRand, 0, 3) . "/" . $strRand;
             if (substr($strSavePath, -1) == "/") {
                 $subDir = $strSavePath . $strRand;
             } else {
                 $subDir = $strSavePath . "/" . $strRand;
             }
             $subDir = ltrim($subDir, "/");
             $filePath = "/" . $subDir . "/" . $newName;
             if (!$bucket->FileExists($filePath)) {
                 break;
             }
         }
         $targetPath = $bucket->GetFileSRC("/");
         if (strpos($arFile["tmp_name"], $targetPath) === 0) {
             $arDbFile = array("SUBDIR" => "", "FILE_NAME" => substr($arFile["tmp_name"], strlen($targetPath)), "CONTENT_TYPE" => $arFile["type"]);
             $copyPath = $bucket->FileCopy($arDbFile, $filePath);
             if (!$copyPath) {
                 return false;
             }
             $copySize = $bucket->GetFileSize("/" . urldecode(substr($copyPath, strlen($targetPath))));
         } else {
             $imgArray = CFile::GetImageSize($arFile["tmp_name"], true, false);
             if (is_array($imgArray) && $imgArray[2] == IMAGETYPE_JPEG) {
                 $exifData = CFile::ExtractImageExif($arFile["tmp_name"]);
                 if ($exifData && isset($exifData['Orientation'])) {
                     $properlyOriented = CFile::ImageHandleOrientation($exifData['Orientation'], $arFile["tmp_name"]);
                     if ($properlyOriented) {
                         $jpgQuality = intval(COption::GetOptionString('main', 'image_resize_quality', '95'));
                         if ($jpgQuality <= 0 || $jpgQuality > 100) {
                             $jpgQuality = 95;
                         }
                         imagejpeg($properlyOriented, $arFile["tmp_name"], $jpgQuality);
                     }
                 }
             }
             if (!$bucket->SaveFile($filePath, $arFile)) {
                 return false;
             }
         }
     }
     $arFile["HANDLER_ID"] = $bucket->ID;
     $arFile["SUBDIR"] = $subDir;
     $arFile["FILE_NAME"] = $newName;
     $arFile["WIDTH"] = 0;
     $arFile["HEIGHT"] = 0;
     if (array_key_exists("bucket", $arFile)) {
         $arFile["WIDTH"] = $arFile["width"];
         $arFile["HEIGHT"] = $arFile["height"];
         $arFile["size"] = $arFile["file_size"];
     } elseif ($copySize !== false) {
         $arFile["size"] = $copySize;
         $bucket->IncFileCounter($copySize);
     } else {
         $bucket->IncFileCounter(filesize($arFile["tmp_name"]));
         $flashEnabled = !CFile::IsImage($arFile["ORIGINAL_NAME"], $arFile["type"]);
         $imgArray = CFile::GetImageSize($arFile["tmp_name"], true, $flashEnabled);
         if (is_array($imgArray)) {
             $arFile["WIDTH"] = $imgArray[0];
             $arFile["HEIGHT"] = $imgArray[1];
         }
     }
     if (isset($arFile["old_file"])) {
         CFile::DoDelete($arFile["old_file"]);
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:storage.php

示例7: str_replace

 }
 $arParams["PATH_TO_FONT"] = str_replace(array("\\", "//"), "/", trim($arParams["PATH_TO_FONT"]));
 if (file_exists($_SERVER['DOCUMENT_ROOT'] . $arParams["PATH_TO_FONT"])) {
     $arParams["PATH_TO_FONT"] = $_SERVER['DOCUMENT_ROOT'] . $arParams["PATH_TO_FONT"];
 } else {
     $arParams["PATH_TO_FONT"] = str_replace(array("\\", "//"), "/", $_SERVER['DOCUMENT_ROOT'] . "/" . BX_ROOT . "/modules/photogallery/fonts/" . trim($arParams["PATH_TO_FONT"]));
     $arParams["PATH_TO_FONT"] = file_exists($arParams["PATH_TO_FONT"]) ? $arParams["PATH_TO_FONT"] : "";
 }
 $arParams["WATERMARK_COLOR"] = '#' . trim($arParams["WATERMARK_COLOR"], ' #');
 $arParams["WATERMARK_SIZE"] = intVal($arParams["WATERMARK_SIZE"]);
 $arParams["WATERMARK_FILE_REL"] = '/' . trim($arParams["WATERMARK_FILE"], ' /');
 $arParams["WATERMARK_FILE"] = str_replace(array("\\", "//"), "/", $_SERVER['DOCUMENT_ROOT'] . $arParams["WATERMARK_FILE_REL"]);
 $arParams["WATERMARK_FILE"] = file_exists($arParams["WATERMARK_FILE"]) ? $arParams["WATERMARK_FILE"] : "";
 $arParams["WATERMARK_FILE_ORDER"] = strtolower($arParams["WATERMARK_FILE_ORDER"]);
 $arParams["WATERMARK_POSITION"] = trim($arParams["WATERMARK_POSITION"]);
 if ($arParams["WATERMARK_FILE"] && CFile::IsImage($arParams["WATERMARK_FILE"])) {
     $imgArray = CFile::GetImageSize($arParams["WATERMARK_FILE"]);
     $arParams["WATERMARK_FILE_WIDTH"] = $imgArray[0];
     $arParams["WATERMARK_FILE_HEIGHT"] = $imgArray[1];
 } else {
     $arParams["WATERMARK_FILE"] = "";
     $arParams["WATERMARK_FILE_REL"] = "";
 }
 $arPositions = array("TopLeft", "TopCenter", "TopRight", "CenterLeft", "Center", "CenterRight", "BottomLeft", "BottomCenter", "BottomRight");
 $arPositions2 = array("tl", "tc", "tr", "ml", "mc", "mr", "bl", "bc", "br");
 if (in_array($arParams["WATERMARK_POSITION"], $arPositions2)) {
     $arParams["WATERMARK_POSITION"] = str_replace($arPositions2, $arPositions, $arParams["WATERMARK_POSITION"]);
 } else {
     $arParams["WATERMARK_POSITION"] = "BottomRight";
 }
 $arParams["WATERMARK_TRANSPARENCY"] = trim($arParams["WATERMARK_TRANSPARENCY"]);
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例8: __MPLParseRecordsHTML

function __MPLParseRecordsHTML(&$response, &$arParams, &$arResult)
{
    $JSResult = array();
    $FHParser = new MPLSimpleHTMLParser($response);
    $SHParser = new MPLSimpleHTMLParser($GLOBALS["APPLICATION"]->GetHeadStrings());
    if ($_REQUEST["MODE"] == "LIST") {
        $messageList = $SHParser->getInnerHTML('<!--LOAD_SCRIPT-->', '<!--END_LOAD_SCRIPT-->') . $FHParser->getInnerHTML('<!--RCRDLIST_' . $arParams["ENTITY_XML_ID"] . '-->', '<!--RCRDLIST_END_' . $arParams["ENTITY_XML_ID"] . '-->');
        $messageNavigation = $FHParser->getTagHTML('a[class=feed-com-all]');
        $JSResult += array('status' => true, 'messageList' => $messageList, 'navigation' => $messageNavigation);
    } else {
        if ($_REQUEST["MODE"] == "RECORD") {
            $arParams["RESULT"] = !!$arParams["RESULT"] ? $arParams["RESULT"] : $_REQUEST["MID"];
            $message = $FHParser->getInnerHTML('<!--RCRD_' . $arParams["ENTITY_XML_ID"] . "-" . $arParams["RESULT"] . '-->', '<!--RCRD_END_' . $arParams["ENTITY_XML_ID"] . "-" . $arParams["RESULT"] . '-->');
            $res = $arParams["RECORDS"][$arParams["RESULT"]];
            if (!!$res["FILES"] && $res["PANELS"]["EDIT"] == "Y") {
                $_SESSION["MFI_UPLOADED_FILES_" . $arParams["mfi"]] = array();
                foreach ($res["FILES"] as $key => $arFile) {
                    $_SESSION["MFI_UPLOADED_FILES_" . $arParams["mfi"]][] = $key;
                    if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                        $aImgNew = CFile::ResizeImageGet($key, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true);
                        $res["FILES"][$key]["THUMBNAIL"] = $aImgNew["src"];
                        $aImgNew = CFile::ResizeImageGet($key, array("width" => $arParams["IMAGE_SIZE"], "height" => $arParams["IMAGE_SIZE"]), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                        $res["FILES"][$key]["SRC"] = $aImgNew["src"];
                    }
                }
            }
            $JSResult += array('errorMessage' => $arParams["ERROR_MESSAGE"], 'okMessage' => $arParams["OK_MESSAGE"], 'status' => true, 'message' => $SHParser->getInnerHTML('<!--LOAD_SCRIPT-->', '<!--END_LOAD_SCRIPT-->') . $message, 'messageBBCode' => $arParams["RECORDS"][$arParams["RESULT"]]["~POST_MESSAGE_TEXT"], 'messageId' => array($arParams["ENTITY_XML_ID"], $arParams["RESULT"]), 'messageFields' => $res);
        }
    }
    $arResult["JSON"] = $JSResult;
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:html_parser.php

示例9: getHistoryFileData

 /**
  * @param $id
  * @param $wfId
  * @param $params
  * @return array
  */
 public function getHistoryFileData($id, $wfId, &$params)
 {
     $fullpath = '';
     $options = $arFile = $arr = array();
     $io = self::GetIo();
     $arFilter = array("IBLOCK_ID" => isset($this->arParams['element_array']['ID']) && $this->arParams['element_array']['ID'] == $id ? $this->arParams['element_array']['IBLOCK_ID'] : $this->IBLOCK_ID, "ID" => $id, "SHOW_HISTORY" => "Y", "CHECK_PERMISSIONS" => "Y");
     if ($this->permission < "U") {
         $arFilter["SHOW_HISTORY"] = "N";
     }
     if (($this->workflow == 'bizproc' || $this->workflow == 'bizproc_limited') && $wfId > 0) {
         $history = new CBPHistoryService();
         $db_res = $history->GetHistoryList(array("ID" => "DESC"), array("DOCUMENT_ID" => array($this->wfParams['DOCUMENT_TYPE'][0], $this->wfParams['DOCUMENT_TYPE'][1], $id), "ID" => $wfId), false, false, array("ID", "DOCUMENT", "NAME"));
         if ($db_res && ($arr = $db_res->Fetch())) {
             $arFile = array("SRC" => $arr["DOCUMENT"]["PROPERTIES"][$this->file_prop]["VALUE"], "NAME" => $arr["DOCUMENT"]["NAME"]);
             $arr["NAME"] = $arr["DOCUMENT"]["NAME"];
             $fullpath = urldecode($arFile["SRC"]);
             if (substr($fullpath, 0, 4) != "http") {
                 $fullpath = $io->GetPhysicalName($_SERVER['DOCUMENT_ROOT'] . $arFile["SRC"]);
             } else {
                 $fullpath = CWebDavTools::urlEncode($fullpath);
             }
             $arTmpFile = CFile::MakeFileArray($fullpath);
             $fullpath = $arTmpFile['tmp_name'];
             $arFile["FILE_SIZE"] = $arTmpFile["size"];
         }
     } else {
         $arFilter['CHECK_PERMISSIONS'] = 'N';
         //check permissions manual! While infoblock perm's check by every section's (in dropped - we have error).
         $rs = CIBlockElement::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "NAME", "TIMESTAMP_X", "IBLOCK_ID", "PROPERTY_" . $this->file_prop));
         if ($rs && ($arr = $rs->Fetch())) {
             if (empty($this->arParams["element_array"])) {
                 $this->arParams["element_array"] = $arr;
             }
             $arFile = CFile::GetFileArray($arr["PROPERTY_FILE_VALUE"]);
             $options["from_cloud"] = intval($arFile['HANDLER_ID']) > 0 ? "Y" : "N";
             $arTmpFile = array();
             if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                 if ($params["width"] > 0 || $params["height"] > 0) {
                     $arTmpFile = CFile::ResizeImageGet($arFile, array("width" => $params["width"], "height" => $params["height"]), $params["exact"] == "Y" ? BX_RESIZE_IMAGE_EXACT : BX_RESIZE_IMAGE_PROPORTIONAL, true, false, true);
                     $arTmpFile['tmp_name'] = ($options["from_cloud"] == "Y" ? "" : $_SERVER["DOCUMENT_ROOT"]) . $arTmpFile["src"];
                     $options["resized"] = "Y";
                     $arFile["FILE_SIZE"] = $arTmpFile["size"];
                     $arFile["SRC"] = $arTmpFile["src"];
                 }
                 if ($params["cache_image"] == "Y") {
                     $options["cache_time"] = 86400;
                 }
             } else {
                 $params["cache_image"] = "N";
             }
             if (empty($arTmpFile)) {
                 $arTmpFile = CFile::MakeFileArray($arr["PROPERTY_FILE_VALUE"]);
             }
             $fullpath = $arTmpFile['tmp_name'];
         }
     }
     $elementName = $arr['NAME'];
     return array($arFile, $options, $fullpath, $elementName);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:iblock.php

示例10: elseif

                }
            }
        }
    }
} elseif (is_array($_SESSION[$varKeyFiles])) {
    foreach ($_SESSION[$varKeyFiles] as $fileID) {
        $rsFile = CFile::GetByID($fileID);
        if ($arFile = $rsFile->Fetch()) {
            if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                $image_resize = CFile::ResizeImageGet($arFile, array("width" => $arParams["THUMBNAIL_SIZE"], "height" => $arParams["THUMBNAIL_SIZE"]), $arParams["THUMBNAIL_RESIZE_METHOD"] == "EXACT" ? BX_RESIZE_IMAGE_EXACT : BX_RESIZE_IMAGE_PROPORTIONAL, true, false, false);
                $arResult["FILES"][] = array("id" => $fileID, "src" => $image_resize["src"], "name" => $arFile["ORIGINAL_NAME"]);
            } else {
                $arResult["FILES"][] = array("id" => $fileID, "src" => "", "name" => $arFile["ORIGINAL_NAME"]);
            }
        }
    }
}
if (is_array($_SESSION[$varKeyImages])) {
    foreach ($_SESSION[$varKeyImages] as $fileID) {
        $rsFile = CFile::GetByID($fileID);
        if ($arFile = $rsFile->Fetch()) {
            if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                $image_resize = CFile::ResizeImageGet($arFile, array("width" => $arParams["THUMBNAIL_SIZE"], "height" => $arParams["THUMBNAIL_SIZE"]), $arParams["THUMBNAIL_RESIZE_METHOD"] == "EXACT" ? BX_RESIZE_IMAGE_EXACT : BX_RESIZE_IMAGE_PROPORTIONAL, true, false, false);
                $arResult["FILES"][] = array("id" => $fileID, "src" => $image_resize["src"], "name" => $arFile["ORIGINAL_NAME"]);
            } else {
                $arResult["FILES"][] = array("id" => $fileID, "src" => "", "name" => $arFile["ORIGINAL_NAME"]);
            }
        }
    }
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例11: array

    }
    if (empty($arResult["MESSAGE"])) {
        $arError = array("code" => "EMPTY MESSAGE", "title" => GetMessage("F_EMPTY_MID"));
    } elseif ($arParams["PERMISSION"]) {
        if ($arParams["PERMISSION"] < "E") {
            $arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT"));
        }
    } elseif (ForumCurrUserPermissions($arResult["MESSAGE"]["FORUM_ID"]) < "E") {
        $arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT"));
    }
}
if (!empty($arError)) {
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_after.php";
    ShowError(!empty($arError["title"]) ? $arError["title"] : $arError["code"]);
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog.php";
    die;
}
// *************************/Default params*************************************************************
set_time_limit(0);
$options = array();
if ($arParams["ACTION"] == "download") {
    $options["force_download"] = true;
}
if (CFile::IsImage($arResult["FILE"]["ORIGINAL_NAME"], $arResult["FILE"]["CONTENT_TYPE"])) {
    if ($arParams['WIDTH'] > 0 && $arParams['HEIGHT'] > 0) {
        $arFileTmp = CFile::ResizeImageGet($arResult['FILE'], array("width" => $arParams["WIDTH"], "height" => $arParams["HEIGHT"]), BX_RESIZE_IMAGE_PROPORTIONAL, true);
        $arResult['FILE']["FILE_SIZE"] = $arFileTmp['size'];
        $arResult['FILE']["SRC"] = $arFileTmp['src'];
    }
}
CFile::ViewByUser($arResult["FILE"], $options);
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:show_file.php

示例12: array

        $file_res = array("status" => "success");
        if (!empty($ob->LAST_ERROR)) {
            $file_res = array("status" => "error", "error" => array(array("id" => "error", "text" => $ob->LAST_ERROR)));
        }
    } else {
        $bVarsFromForm = true;
        $file_res = array("status" => "error", "error" => $arFileError);
    }
    // Main info about file
    // Additional info about file
    $file_res["id"] = $arElement["ID"];
    $file_res["number"] = $number;
    $file_res["title"] = $name;
    $file_res["description"] = $arFields["PREVIEW_TEXT"];
    $file_res["content_type"] = $arFile["type"];
    if (CFile::IsImage($name, $arFile["type"])) {
        $file_res["width"] = 0;
        $file_res["height"] = 0;
        $imgArray = CFile::GetImageSize($arFile["tmp_name"], true);
        if (is_array($imgArray)) {
            $file_res["width"] = $imgArray[0];
            $file_res["height"] = $imgArray[1];
        }
    }
    $result["FILE"][$name] = $file_res;
    $result["FILE_INFO"][$arFile["name"]] = $file_res;
}
/************** Answer **********************************************/
$url = $wuo->getUrl();
$bVarsFromForm = $bVarsFromForm ? $bVarsFromForm : !empty($arError);
$uploader = array();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:action_iblock.php

示例13: parseHTML

 private function parseHTML($response, $mode = "RECORD")
 {
     include_once __DIR__ . "/html_parser.php";
     $JSResult = array();
     $FHParser = new MPLSimpleHTMLParser($response);
     $SHParser = new MPLSimpleHTMLParser($this->getApplication()->GetHeadStrings());
     $arParams =& $this->arParams;
     if ($mode == "LIST") {
         $messageList = $SHParser->getInnerHTML('<!--LOAD_SCRIPT-->', '<!--END_LOAD_SCRIPT-->') . $FHParser->getInnerHTML('<!--RCRDLIST_' . $arParams["ENTITY_XML_ID"] . '-->', '<!--RCRDLIST_END_' . $arParams["ENTITY_XML_ID"] . '-->');
         $messageNavigation = $FHParser->getTagHTML('a[class=feed-com-all]');
         $JSResult += array('status' => "success", 'messageList' => $messageList, 'navigation' => $messageNavigation);
     } else {
         if ($mode == "RECORD") {
             $record = $arParams["RESULT"];
             if ($record <= 0) {
                 $filter = $this->request->getQuery("FILTER");
                 $record = is_array($filter) ? intval($filter["ID"]) : 0;
             }
             $message = $FHParser->getInnerHTML('<!--RCRD_' . $arParams["ENTITY_XML_ID"] . "-" . $record . '-->', '<!--RCRD_END_' . $arParams["ENTITY_XML_ID"] . "-" . $record . '-->');
             $res = false;
             if (array_key_exists($record, $arParams["RECORDS"]) && array_key_exists($record, $arParams["~RECORDS"])) {
                 $res = $arParams["RECORDS"][$record];
                 $res = array_merge($arParams["~RECORDS"][$record], $res, $this->isWeb() ? $res["WEB"] : $res["MOBILE"]);
                 unset($res["WEB"]);
                 unset($res["MOBILE"]);
                 if (!!$res["FILES"] && ($this->arParams["RIGHTS"]["EDIT"] == "ALL" || $this->arParams["RIGHTS"]["EDIT"] == "Y" || $this->arParams["RIGHTS"]["EDIT"] == "OWN" && $res["AUTHOR"]["ID"] == $this->getUser()->getId())) {
                     $_SESSION["MFI_UPLOADED_FILES_" . $arParams["mfi"]] = array();
                     foreach ($res["FILES"] as $key => $arFile) {
                         $_SESSION["MFI_UPLOADED_FILES_" . $arParams["mfi"]][] = $key;
                         if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
                             $aImgNew = CFile::ResizeImageGet($key, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true);
                             $res["FILES"][$key]["THUMBNAIL"] = $aImgNew["src"];
                             $aImgNew = CFile::ResizeImageGet($key, array("width" => $arParams["IMAGE_SIZE"], "height" => $arParams["IMAGE_SIZE"]), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                             $res["FILES"][$key]["SRC"] = $aImgNew["src"];
                         }
                     }
                 }
             }
             $JSResult += array('errorMessage' => $arParams["ERROR_MESSAGE"], 'okMessage' => $arParams["OK_MESSAGE"], 'status' => "success", 'message' => $SHParser->getInnerHTML('<!--LOAD_SCRIPT-->', '<!--END_LOAD_SCRIPT-->') . $message, 'messageBBCode' => $arParams["~RECORDS"][$record]["~POST_MESSAGE_TEXT"], 'messageId' => array($arParams["ENTITY_XML_ID"], $record), 'messageFields' => $res);
         }
     }
     return $JSResult;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:43,代码来源:class.php

示例14: updateAvatar

 /**
  * При загрузке аватара уменьшаем его размер до 150х150px
  */
 public static function updateAvatar($USER_ID)
 {
     $imageMaxWidth = 216;
     // Максимальная ширина уменьшенной картинки
     $imageMaxHeight = 216;
     // Максимальная высота уменьшенной картинки
     $rsUser = \CUser::GetByID($USER_ID);
     $arUser = $rsUser->Fetch();
     if (intval($arUser["PERSONAL_PHOTO"]) > 0) {
         $arFile = \CFile::GetFileArray($arUser["PERSONAL_PHOTO"]);
         // проверяем, что файл является картинкой
         if (!\CFile::IsImage($arFile["FILE_NAME"])) {
             echo "не является картинкой";
             continue;
         }
         // Если размер больше допустимого
         if ($arFile["WIDTH"] > $imageMaxWidth || $arFile["HEIGHT"] > $imageMaxHeight) {
             // Временная картинка
             $tmpFilePath = $_SERVER['DOCUMENT_ROOT'] . "/upload/tmp/" . $arFile["FILE_NAME"];
             // Уменьшаем картинку
             $resizeRez = \CFile::ResizeImageFile($source = $_SERVER['DOCUMENT_ROOT'] . $arFile["SRC"], $dest = $tmpFilePath, array('width' => $imageMaxWidth, 'height' => $imageMaxHeight), $resizeType = BX_RESIZE_IMAGE_EXACT, $waterMark = array(), $jpgQuality = 95);
             // Записываем изменение в свойство
             if ($resizeRez && $tmpFilePath) {
                 $arNewFile = \CFile::MakeFileArray($tmpFilePath);
                 $arNewFile['del'] = "Y";
                 $arNewFile['old_file'] = $arUser['PERSONAL_PHOTO'];
                 $arNewFile["MODULE_ID"] = "main";
                 $fields['PERSONAL_PHOTO'] = $arNewFile;
                 $user = new \CUser();
                 $user->Update($arUser["ID"], $fields);
                 $rsUser = \CUser::GetByID($USER_ID);
                 $arUser = $rsUser->Fetch();
                 // Удалим временный файл
                 unlink($tmpFilePath);
             }
         }
     }
     return $arUser;
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:42,代码来源:CUserEx.php

示例15: WDUFLoadStyle

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (sizeof($arResult['FILES']) <= 0) {
    return;
}
WDUFLoadStyle();
$jsIds = "";
foreach ($arResult['FILES'] as $id => $arWDFile) {
    if (CFile::IsImage($arWDFile['NAME'])) {
        $nodeId = "webdav-inline-" . $id . "-" . randString(4);
        $jsIds .= $jsIds !== "" ? ', "' . $nodeId . '"' : '"' . $nodeId . '"';
        ?>
<img src="<?php 
        echo CMobileLazyLoad::getBase64Stub();
        ?>
" <?php 
        ?>
 border="0" <?php 
        ?>
 data-preview-src="<?php 
        echo $arWDFile['SMALL_SRC'];
        ?>
" <?php 
        ?>
 data-src="<?php 
        echo $arWDFile['SRC'];
        ?>
" <?php 
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:view_with_features.php


注:本文中的CFile::IsImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。