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


PHP Fx::image方法代码示例

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


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

示例1: route

 public function route($url = null, $context = null)
 {
     $thumbs_path = fx::path()->http('@thumbs');
     $thumbs_path_trimmed = fx::path()->removeBase($thumbs_path);
     if (substr($url, 0, strlen($thumbs_path_trimmed)) !== $thumbs_path_trimmed) {
         return null;
     }
     $dir = substr($url, strlen($thumbs_path_trimmed));
     preg_match("~/([^/]+)(/.+\$)~", $dir, $parts);
     $config = $parts[1];
     $source_path = $parts[2];
     $source_abs = fx::path($source_path);
     if (!file_exists($source_abs)) {
         return null;
     }
     $target_dir = dirname(fx::path('@home/' . $url));
     if (!file_exists($target_dir) || !is_dir($target_dir)) {
         return null;
     }
     $config = $config . '.async-false.output-true';
     $config = \Floxim\Floxim\System\Thumb::readConfigFromPathString($config);
     fx::image($source_path, $config);
     fx::complete();
     die;
 }
开发者ID:floxim,项目名称:floxim,代码行数:25,代码来源:Thumb.php

示例2: uploadSave

 public function uploadSave($input)
 {
     $path = 'upload';
     $result = fx::files()->saveFile($input['file'], $path);
     if (!$result) {
         $result = array('error_message' => 'Can not load this file');
         fx::http()->status(500);
     }
     if (isset($input['format']) && !empty($input['format']) && isset($result['path'])) {
         $result['formatted_value'] = fx::image($result['path'], $input['format']);
     }
     return $result;
 }
开发者ID:floxim,项目名称:floxim,代码行数:13,代码来源:File.php

示例3: all

 /**
  * List all content of specified type
  *
  * @param type $input
  */
 public function all($input)
 {
     $content_type = $input['content_type'];
     $list = array('type' => 'list', 'values' => array(), 'labels' => array('id' => 'ID'), 'entity' => 'content');
     if ($content_type === 'content') {
         $list['labels']['type'] = 'Type';
     }
     $com = fx::data('component', $content_type);
     $fields = $com->getAllFields();
     $ib_field = $fields->findOne('keyword', 'infoblock_id');
     if ($ib_field) {
         $list['labels']['infoblock'] = $ib_field['name'];
     }
     $fields->findRemove(function ($f) {
         if ($f['keyword'] === 'parent_id' || $f['keyword'] === 'type' || $f['keyword'] === 'site_id') {
             return false;
         }
         return $f['type_of_edit'] == Field\Entity::EDIT_NONE;
     });
     foreach ($fields as $f) {
         $list['labels'][$f['keyword']] = $f['name'];
     }
     $finder = fx::content($content_type);
     $pager = $finder->createPager(array('url_template' => $input['url_template'], 'current_page' => $input['page'], 'items_per_page' => 100));
     $items = $finder->all();
     $list['pager'] = $pager->getData();
     $ib_ids = $items->getValues('infoblock_id');
     $infoblocks = fx::data('infoblock', $ib_ids)->indexUnique('id');
     foreach ($items as $item) {
         $r = array('id' => $item['id']);
         $r['type'] = $item['type'];
         $c_ib = $infoblocks->findOne('id', $item['infoblock_id']);
         $r['infoblock'] = $c_ib ? $c_ib['name'] : '-';
         foreach ($fields as $f) {
             $val = $item[$f['keyword']];
             switch ($f['type']) {
                 case Field\Entity::FIELD_LINK:
                     if ($val) {
                         $linked = fx::data($f->getRelatedType(), $val);
                         $val = $linked['name'];
                     }
                     break;
                 case Field\Entity::FIELD_STRING:
                 case Field\Entity::FIELD_TEXT:
                     $val = strip_tags($val);
                     $val = mb_substr($val, 0, 150);
                     break;
                 case Field\Entity::FIELD_IMAGE:
                     $val = fx::image($val, 'max-width:100px,max-height:50px');
                     $val = '<img src="' . $val . '" alt="" />';
                     break;
                 case Field\Entity::FIELD_MULTILINK:
                     $val = fx::alang('%d items', 'system', count($val));
                     break;
             }
             $r[$f['keyword']] = $val;
         }
         $list['values'][] = $r;
     }
     $this->response->addButtons(array(array('key' => "delete", 'content_type' => $content_type)));
     return array('fields' => array('list' => $list));
 }
开发者ID:floxim,项目名称:floxim,代码行数:67,代码来源:Content.php


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