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


PHP Cabinet::getResizes方法代码示例

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


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

示例1: edit

 /**
  * Upload image form
  */
 public function edit($force_width = 0, $force_height = 0)
 {
     $form = new PHPWS_Form();
     $form->setFormId('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('iop', 'post_image_upload');
     $form->addHidden('ms', $this->max_size);
     $form->addHidden('mh', $this->max_height);
     $form->addHidden('mw', $this->max_width);
     $form->addHidden('folder_id', $this->folder->id);
     if ($this->image->id && Current_User::allow('filecabinet', 'edit_folders', $this->folder->id, 'folder', true)) {
         Cabinet::moveToForm($form, $this->folder);
     }
     // if 'im' is set, then we are inside the image manage interface
     // the post needs to be aware of that to respond correctly
     if (isset($_GET['im'])) {
         $form->addHidden('im', 1);
     }
     if ($this->image->id) {
         $form->addHidden('image_id', $this->image->id);
         $this->title = dgettext('filecabinet', 'Update image');
     } else {
         $this->title = dgettext('filecabinet', 'Upload image');
     }
     $form->addFile('file_name');
     $form->setClass('file_name', 'form-control');
     $form->setSize('file_name', 30);
     $form->setMaxFileSize($this->max_size);
     $form->setLabel('file_name', dgettext('filecabinet', 'Image location'));
     $form->addText('title', $this->image->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     $form->addTextArea('description', $this->image->description);
     $form->setRows('description', 8);
     $form->setCols('description', 45);
     $form->setLabel('description', dgettext('filecabinet', 'Description'));
     if ($this->image->folder_id) {
         $folder = new Folder($this->image->folder_id);
         if ($folder->public_folder) {
             $link_choice['folder'] = dgettext('filecabinet', 'Link to image folder');
         }
     }
     if ($this->folder->max_image_dimension && $this->folder->max_image_dimension < $this->max_width) {
         $max_width = $this->folder->max_image_dimension;
     } else {
         $max_width = $this->max_width;
     }
     if ($force_width && $force_height) {
         $form->addHidden('fw', $force_width);
         $form->addHidden('fh', $force_height);
         $form->addTplTag('RESIZE_LABEL', dgettext('filecabinet', 'Images resized to:'));
         $form->addTplTag('RESIZE', sprintf('%s x %spx', $force_width, $force_height));
     } elseif (!$this->image->id) {
         $resizes = Cabinet::getResizes($max_width);
         if (!empty($resizes)) {
             $form->addSelect('resize', $resizes);
             $form->setLabel('resize', dgettext('filecabinet', 'Resize image if over'));
         }
     }
     switch (1) {
         case empty($this->image->url):
             $form->setMatch('link', 'none');
             $form->addTplTag('VISIBLE', 'none');
             $form->setValue('url', 'http://');
             break;
         case $this->image->url == 'parent':
             $form->setMatch('link', 'parent');
             $form->addTplTag('VISIBLE', 'none');
             break;
         case $this->image->url == 'folder':
             $form->setMatch('link', 'folder');
             $form->addTplTag('VISIBLE', 'none');
             break;
         default:
             $form->setMatch('link', 'url');
             $form->setValue('url', $this->image->url);
             $form->addTplTag('VISIBLE', 'table-row');
             break;
     }
     if (!empty($this->image->id)) {
         $form->addSubmit('submit', dgettext('filecabinet', 'Update'));
     } else {
         $form->addSubmit('submit', dgettext('filecabinet', 'Upload'));
     }
     $form->setClass('submit', 'btn btn-primary');
     $template = $form->getTemplate();
     $template['CANCEL'] = sprintf('<input type="button" value="%s" onclick="javascript:window.close()" />', dgettext('filecabinet', 'Cancel'));
     if ($this->image->id) {
         $template['CURRENT_IMAGE_LABEL'] = dgettext('filecabinet', 'Current image');
         $template['CURRENT_IMAGE'] = $this->image->getJSView(TRUE);
         $template['SIZE'] = sprintf('%s x %s', $this->image->width, $this->image->height);
     }
     $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size');
     $template['MAX_DIMENSION_LABEL'] = dgettext('filecabinet', 'Maximum image dimension');
     $template['MAX_DIMENSION'] = $this->max_width;
     $sys_size = str_replace('M', '', ini_get('upload_max_filesize'));
     $sys_size = $sys_size * 1000000;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Image_Manager.php

示例2: editFolder

 public function editFolder($folder, $js = false)
 {
     $form = new PHPWS_Form('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('aop', 'post_folder');
     $form->addHidden('ftype', $folder->ftype);
     if ($js) {
         $form->addHidden('js', 1);
     }
     if ($folder->id) {
         $form->addHidden('folder_id', $folder->id);
     }
     $form->addTextField('title', $folder->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     if ($folder->ftype == DOCUMENT_FOLDER) {
         $form->addRadio('public_folder', array(0, 1));
         $form->setLabel('public_folder', array(dgettext('filecabinet', 'Indirect links'), dgettext('filecabinet', 'Direct links')));
     }
     $form->setMatch('public_folder', $folder->public_folder);
     if ($folder->ftype == IMAGE_FOLDER) {
         $resizes = Cabinet::getResizes(0, true);
         $form->addSelect('max_image_dimension', $resizes);
         $form->setLabel('max_image_dimension', dgettext('filecabinet', 'Maximum image upload dimension'));
         $form->setMatch('max_image_dimension', $folder->max_image_dimension);
         $form->setClass('max_image_dimension', 'form-control');
     }
     $form->addSubmit('submit', 'Save folder');
     $form->setClass('submit', 'btn btn-primary');
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/edit_folder.tpl');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:32,代码来源:Forms.php


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