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


PHP file::is_image方法代码示例

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


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

示例1: get_upload_data

 /**
  * get full information for an upload
  *
  * @param string $file 
  * @param array $file_data 
  * @return array
  * @author Andy Bennett
  */
 function get_upload_data($file, $file_data)
 {
     $filename = self::save($file);
     if (APPENV == 'frontend') {
         $upl_dir = str_replace('frontend', 'backend', Kohana::config('upload.directory'));
         if (!copy($filename, $upl_dir . basename($filename))) {
             Kohana::log('error', "COPY FAILED: copy({$filename}, {$upl_dir}.basename({$filename}))");
         }
     }
     $pp = pathinfo($filename);
     $ext = $pp['extension'];
     $file_type = self::check_filetype($file_data['type'], $filename);
     $d = Kohana::config('upload.directory');
     $upload_data['file_name'] = $pp['basename'];
     $upload_data['file_type'] = $file_type;
     $upload_data['file_path'] = $d;
     $upload_data['full_path'] = $filename;
     $upload_data['raw_name'] = $pp['filename'];
     $upload_data['orig_name'] = $file_data['name'];
     $upload_data['file_ext'] = '.' . strtolower($ext);
     $upload_data['file_size'] = $file_data['size'];
     $upload_data['is_image'] = file::is_image($file_type);
     $upload_data['date_added'] = date('Y-m-d H:i:s');
     if ($upload_data['is_image']) {
         $properties = file::get_image_properties($filename);
         if (!empty($properties)) {
             $upload_data = array_merge($upload_data, $properties);
         }
     }
     return $upload_data;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:39,代码来源:MY_upload.php

示例2: get_upload_data

 /**
  * get full information for an upload
  *
  * @param string $file 
  * @param array $file_data 
  * @return array
  * @author Andy Bennett
  */
 function get_upload_data($file, $file_data, $save = true)
 {
     $filename = $save ? upload::save($file_data) : $file;
     if (!strlen($filename)) {
         throw new Exception("Empty filename", 1);
     }
     $pp = pathinfo($filename);
     $ext = strtolower($pp['extension']);
     $file_type = uploads::check_filetype($file_data['type'], $filename, $ext);
     $d = Kohana::config('upload.directory');
     $upload_data['file_name'] = $pp['basename'];
     $upload_data['file_type'] = $file_type;
     $upload_data['file_path'] = $d;
     $upload_data['full_path'] = $filename;
     $upload_data['raw_name'] = $pp['filename'];
     $upload_data['orig_name'] = $file_data['name'];
     $upload_data['file_ext'] = '.' . strtolower($ext);
     $upload_data['file_size'] = $file_data['size'];
     $upload_data['is_image'] = file::is_image($file_type);
     $upload_data['is_video'] = 0;
     $upload_data['is_audio'] = 0;
     $upload_data['date_added'] = date('Y-m-d H:i:s');
     $upload_data['preview'] = false;
     $driver = uploads::get_driver($upload_data['is_image'], $file_type, $ext);
     if ($driver !== false) {
         // Load the driver
         if (Kohana::auto_load($driver)) {
             // Initialize the driver
             $upload_driver = new $driver();
             // Validate the driver
             if (!$upload_driver instanceof Uploader_Driver) {
                 throw new Kohana_Exception('core.driver_implements', $driver, 'upload', 'Uploader_Driver');
             }
             $upload_driver->generate_preview($upload_data, $filename, $ext);
         }
     }
     if ($upload_data['is_image']) {
         $properties = file::get_image_properties($filename);
         if (!empty($properties)) {
             $upload_data = array_merge($upload_data, $properties);
         }
     }
     return $upload_data;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:52,代码来源:uploads.php

示例3: render

 /**
  * undocumented function
  *
  * @param string $path 
  * @return void
  * @author Andy Bennett
  */
 protected function render($path, $download = false, $orig_name = null)
 {
     Kohana::close_buffers(false);
     if (is_null($orig_name)) {
         $orig_name = basename($path);
     }
     $file_type = uploads::check_filetype(file::mime($path), $path);
     header('Content-type: ' . $file_type);
     if (!file::is_image($file_type) or $download) {
         header('Content-Disposition: attachment; filename="' . $orig_name . '"');
     }
     header("Content-Length: " . filesize($path));
     readfile($path);
     exit;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:22,代码来源:Files.php

示例4: render

 /**
  * undocumented function
  *
  * @param string $path 
  * @return void
  * @author Andy Bennett
  */
 protected function render($path, $download = false, $orig_name = null)
 {
     Kohana::close_buffers(false);
     if (is_null($orig_name)) {
         $orig_name = basename($path);
     }
     $file_type = mimes::check($path);
     header('Content-type: ' . $file_type);
     if (!file::is_image($file_type) and strpos($file_type, 'flash') === false or $download) {
         header('Content-Disposition: attachment; filename="' . $orig_name . '"');
     }
     header("Content-Length: " . filesize($path));
     readfile($path);
     if ($this->delete_fullpath) {
         unlink($this->delete_fullpath);
     }
     exit;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:25,代码来源:Files.php


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