本文整理汇总了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');
}
}
示例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;
}
}
示例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;
}
}
示例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;
}