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


PHP ilObjFile::getFile方法代码示例

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


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

示例1: renderImages

 /**
  * Renders the specified object into images.
  * The images do not need to be of the preview image size.
  * 
  * @param ilObjFile $obj The object to create images from.
  * @return array An array of ilRenderedImage containing the absolute file paths to the images.
  */
 protected function renderImages($obj)
 {
     $numOfPreviews = $this->getMaximumNumberOfPreviews();
     // get file path
     $filepath = $obj->getFile();
     $inputFile = $this->prepareFileForExec($filepath);
     // create a temporary file name and remove its extension
     $output = str_replace(".tmp", "", ilUtil::ilTempnam());
     // use '#' instead of '%' as it gets replaced by 'escapeShellArg' on windows!
     $outputFile = $output . "_#02d.png";
     // create images with ghostscript (we use PNG here as it has better transparency quality)
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=pngalpha -dEPSCrop -r72 -o $outputFile $inputFile
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=jpeg -dJPEGQ=90 -r72 -o $outputFile $inputFile
     $args = sprintf("-dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=%d -sDEVICE=pngalpha -dEPSCrop -r72 -o %s %s", $numOfPreviews, str_replace("#", "%", ilUtil::escapeShellArg($outputFile)), ilUtil::escapeShellArg($inputFile));
     ilUtil::execQuoted(PATH_TO_GHOSTSCRIPT, $args);
     // was a temporary file created? then delete it
     if ($filepath != $inputFile) {
         @unlink($inputFile);
     }
     // check each file and add it
     $images = array();
     $outputFile = str_replace("#", "%", $outputFile);
     for ($i = 1; $i <= $numOfPreviews; $i++) {
         $imagePath = sprintf($outputFile, $i);
         if (!file_exists($imagePath)) {
             break;
         }
         $images[] = new ilRenderedImage($imagePath);
     }
     return $images;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilGhostscriptRenderer.php

示例2: renderImages

 /**
  * Renders the specified object into images.
  * The images do not need to be of the preview image size.
  * 
  * @param ilObjFile $obj The object to create images from.
  * @return array An array of ilRenderedImage containing the absolute file paths to the images.
  */
 protected function renderImages($obj)
 {
     $filepath = $obj->getFile();
     $tmpPath = $this->prepareFileForExec($filepath);
     $isTemporary = $tmpPath != $filepath;
     return array(new ilRenderedImage($tmpPath . "[0]", $isTemporary));
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:14,代码来源:class.ilImageMagickRenderer.php

示例3: sendFile

 /**
  * send File to User
  */
 public function sendFile()
 {
     global $ilAccess;
     //need read access to receive file
     if ($ilAccess->checkAccess("read", "", $this->parent_obj->ref_id)) {
         $rec_id = $_GET['record_id'];
         $record = ilDataCollectionCache::getRecordCache($rec_id);
         $field_id = $_GET['field_id'];
         $file_obj = new ilObjFile($record->getRecordFieldValue($field_id), false);
         if (!$this->recordBelongsToCollection($record, $this->parent_obj->ref_id)) {
             return;
         }
         ilUtil::deliverFile($file_obj->getFile(), $file_obj->getTitle());
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:18,代码来源:class.ilDataCollectionRecordListGUI.php


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