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


PHP Files::get_file方法代码示例

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


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

示例1: watermark

 private function watermark($data = array())
 {
     $this->load->library('files/files');
     $mark_text = isset($data['text']) ? $data['text'] : Settings::get('site_name');
     $font_color = isset($data['font_color']) ? $data['font_color'] : 'ffffff';
     $opacity = isset($data['opacity']) ? (int) $data['opacity'] : 100;
     $font_size = isset($data['font_size']) ? (int) $data['font_size'] : 12;
     $files = $data['files'];
     $font_path = './' . SHARED_ADDONPATH . 'modules/watermark/fonts/Gabrielle.ttf';
     if (is_array($files) && count($files) > 0) {
         foreach ($files as $file) {
             $filedata = Files::get_file($file);
             if ($filedata['status'] === TRUE) {
                 $dirpath = FCPATH . '/uploads/default/files/';
                 $source = $dirpath . $filedata['data']->filename;
                 $imageLayer = ImageWorkshop::initFromPath($source);
                 //var_dump($imageLayer);exit;
                 $textLayer = ImageWorkshop::initTextLayer($mark_text, $font_path, $font_size, $font_color, $data['rotation']);
                 $textLayer->opacity($opacity);
                 $imageLayer->addLayerOnTop($textLayer, 12, 12, $data['position']);
                 $image = $imageLayer->getResult();
                 $imageLayer->save($dirpath, $filedata['data']->filename, false, null, 100);
                 $wm_data = array('file_id' => $filedata['data']->id, 'folder_id' => $filedata['data']->folder_id);
                 $this->watermark_m->insert($wm_data);
             }
         }
         $this->session->set_flashdata('success', lang('watermark:submit_success'));
         redirect('admin/watermark');
     } else {
         $this->session->set_flashdata('error', lang('watermark:no_files_remaining'));
         redirect('admin/watermark');
     }
 }
开发者ID:jacksun101,项目名称:PyroAddons,代码行数:33,代码来源:admin.php

示例2: pre_output_plugin

 public function pre_output_plugin($data, $params)
 {
     if (!$data or $data == 'dummy') {
         return null;
     }
     $this->CI->load->library('files/files');
     $input = unserialize($data);
     $file = Files::get_file($input["id"]);
     if ($file['status']) {
         $image = $file['data'];
         if (!$image->path) {
             $image_data['image'] = base_url($this->CI->config->item('files:path') . $image->filename);
         } else {
             $image_data['image'] = str_replace('{{ url:site }}', base_url(), $image->path);
         }
         $alt = $this->obvious_alt($image);
         $url_start = BASE_URL . 'filesc/thumb/';
         $url_end = '/' . $input["x"] . '/' . $input["x2"] . '/' . $input["y"] . '/' . $input["y2"] . '/' . $input["id"] . '/' . $image->filename;
         $image_data['filename'] = $image->filename;
         $image_data['name'] = $image->name;
         $image_data['alt'] = $image->alt_attribute;
         $image_data['description'] = $image->description;
         $image_data['img'] = img(array('alt' => $alt, 'src' => $image_data['image']));
         $image_data['ext'] = $image->extension;
         $image_data['mimetype'] = $image->mimetype;
         $image_data['width'] = $image->width;
         $image_data['height'] = $image->height;
         $image_data['id'] = $image->id;
         $image_data['filesize'] = $image->filesize;
         $image_data['download_count'] = $image->download_count;
         $image_data['date_added'] = $image->date_added;
         $image_data['folder_id'] = $image->folder_id;
         $image_data['folder_name'] = $image->folder_name;
         $image_data['folder_slug'] = $image->folder_slug;
         // thumb url
         $image_data['thumb']['image'] = $url_start . $params["crop_width"] . '/' . $params["crop_height"] . $url_end;
         // thumb [IMG]
         $image_data['thumb']['img'] = img(array('alt' => $alt, 'src' => $url_start . $params["crop_width"] . '/' . $params["crop_height"] . $url_end));
         // zoom images (thumb_zoom.90.img / thumb_zoom.90.url)
         for ($i = 1; $i < 100; $i++) {
             $zoom = 100 - $i;
             $image_data['thumb']["scale"][$zoom]["image"] = $url_start . round($params["crop_width"] * $zoom / 100) . '/' . round($params["crop_height"] * $zoom / 100) . $url_end;
             $image_data['thumb']["scale"][$zoom]["img"] = img(array('alt' => $alt, 'src' => $url_start . round($params["crop_width"] * $zoom / 100) . '/' . round($params["crop_height"] * $zoom / 100) . $url_end));
         }
         return $image_data;
     }
 }
开发者ID:jacksun101,项目名称:PyroAddons,代码行数:47,代码来源:field.imagecrop.php

示例3: pre_output_plugin

 public function pre_output_plugin($input, $params)
 {
     if (!$input or $input == 'dummy') {
         return null;
     }
     $this->CI->load->library('files/files');
     $file = Files::get_file($input);
     if ($file['status']) {
         $image = $file['data'];
         // If we don't have a path variable, we must have an
         // older style image, so let's create a local file path.
         if (!$image->path) {
             $image_data['image'] = base_url($this->CI->config->item('files:path') . $image->filename);
         } else {
             $image_data['image'] = str_replace('{{ url:site }}', base_url(), $image->path);
         }
         // For <img> tags only
         $alt = $this->obvious_alt($image);
         $image_data['filename'] = $image->filename;
         $image_data['name'] = $image->name;
         $image_data['alt'] = $image->alt_attribute;
         $image_data['description'] = $image->description;
         $image_data['img'] = img(array('alt' => $alt, 'src' => $image_data['image']));
         $image_data['ext'] = $image->extension;
         $image_data['mimetype'] = $image->mimetype;
         $image_data['width'] = $image->width;
         $image_data['height'] = $image->height;
         $image_data['id'] = $image->id;
         $image_data['filesize'] = $image->filesize;
         $image_data['download_count'] = $image->download_count;
         $image_data['date_added'] = $image->date_added;
         $image_data['folder_id'] = $image->folder_id;
         $image_data['folder_name'] = $image->folder_name;
         $image_data['folder_slug'] = $image->folder_slug;
         $image_data['thumb'] = site_url('files/thumb/' . $input);
         $image_data['large'] = site_url('files/large/' . $input);
         $image_data['thumb_img'] = img(array('alt' => $alt, 'src' => site_url('files/thumb/' . $input)));
         return $image_data;
     }
 }
开发者ID:jacksun101,项目名称:PyroAddons,代码行数:40,代码来源:field.imagepicker.php

示例4: alt_pre_output

 /** Alt Pre output * */
 public function alt_pre_output($row_id, $params, $field_type, $stream)
 {
     if ($this->CI->uri->segment(1) == 'admin') {
         return false;
     }
     $table = $this->_table_data((object) $params);
     $file_id_column = !empty($table->file_id_column) ? $table->file_id_column : 'file_id';
     $resource_id_column = !empty($table->resource_id) ? $table->resource_id : 'resource_id';
     $images = $this->CI->db->where($resource_id_column, (int) $row_id)->get($table->table)->result_array();
     $return = array();
     if (!empty($images)) {
         foreach ($images as &$image) {
             $this->CI->load->library('files/files');
             $file_id = $image[$file_id_column];
             $file = Files::get_file($file_id);
             $image_data = array();
             if ($file['status']) {
                 $image = $file['data'];
                 // If we don't have a path variable, we must have an
                 // older style image, so let's create a local file path.
                 if (!$image->path) {
                     $image_data['image'] = base_url($this->CI->config->item('files:path') . $image->filename);
                 } else {
                     $image_data['image'] = str_replace('{{ url:site }}', base_url(), $image->path);
                 }
                 // For <img> tags only
                 $alt = $this->obvious_alt($image);
                 $image_data['filename'] = $image->filename;
                 $image_data['name'] = $image->name;
                 $image_data['alt'] = $image->alt_attribute;
                 $image_data['description'] = $image->description;
                 $image_data['img'] = img(array('alt' => $alt, 'src' => $image_data['image']));
                 $image_data['ext'] = $image->extension;
                 $image_data['mimetype'] = $image->mimetype;
                 $image_data['width'] = $image->width;
                 $image_data['height'] = $image->height;
                 $image_data['id'] = $image->id;
                 $image_data['filesize'] = $image->filesize;
                 $image_data['download_count'] = $image->download_count;
                 $image_data['date_added'] = $image->date_added;
                 $image_data['folder_id'] = $image->folder_id;
                 $image_data['folder_name'] = $image->folder_name;
                 $image_data['folder_slug'] = $image->folder_slug;
                 $image_data['thumb'] = site_url('files/thumb/' . $file_id);
                 $image_data['thumb_img'] = img(array('alt' => $alt, 'src' => site_url('files/thumb/' . $file_id)));
             }
             $return[] = $image_data;
         }
     }
     return $return;
 }
开发者ID:tonybolanyo,项目名称:PyroCMS-Multiple-Images-FieldType,代码行数:52,代码来源:field.multiple_images.php


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