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


PHP Zend_Filter::appendFilter方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data');
     $renameResize = new Zend_Form_Element_File('renameResize');
     $renameResize->setDestination('../upload');
     $renameResize->setLabel('Rename before resize');
     $renameResize->addFilter('Rename', 'rename-resize');
     $renameResize->addFilter(new Skoch_Filter_File_Resize(array('width' => 200, 'height' => 300, 'keepRatio' => true)));
     $this->addElement($renameResize);
     $resizeRename = new Zend_Form_Element_File('resizeRename');
     $resizeRename->setDestination('../upload');
     $resizeRename->setLabel('Resize before rename');
     $resizeRename->addFilter(new Skoch_Filter_File_Resize(array('width' => 200, 'height' => 300, 'keepRatio' => true)));
     $resizeRename->addFilter('Rename', 'resize-rename');
     $this->addElement($resizeRename);
     $multiResize = new Zend_Form_Element_File('multiResize');
     $multiResize->setDestination('../upload');
     $multiResize->setLabel('Multiple resizes');
     $filterChain = new Zend_Filter();
     // Create one big image with at most 600x300 pixel
     $filterChain->appendFilter(new Skoch_Filter_File_Resize(array('width' => 600, 'height' => 300, 'keepRatio' => true)));
     // Create a medium image with at most 500x200 pixels
     $filterChain->appendFilter(new Skoch_Filter_File_Resize(array('directory' => '../upload/medium', 'width' => 500, 'height' => 200, 'keepRatio' => true)));
     $multiResize->addFilter('Rename', 'multi-resize');
     $multiResize->addFilter($filterChain);
     $this->addElement($multiResize);
     $renameCrop = new Zend_Form_Element_File('renameCrop');
     $renameCrop->setDestination('../upload');
     $renameCrop->setLabel('Rename before crop');
     $renameCrop->addFilter('Rename', 'rename-crop');
     $renameCrop->addFilter(new Skoch_Filter_File_Resize(array('width' => 20, 'height' => 30, 'cropToFit' => true, 'keepRatio' => true)));
     $this->addElement($renameCrop);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElement($submit);
 }
开发者ID:pbleuse-orange,项目名称:skoch-filter-file-resize,代码行数:35,代码来源:Image.php

示例2: testFilterPrependOrder

 /**
  * Ensures that filters can be prepended and will be executed in the
  * expected order
  */
 public function testFilterPrependOrder()
 {
     $this->_filter->appendFilter(new Zend_FilterTest_StripUpperCase())->prependFilter(new Zend_FilterTest_LowerCase());
     $value = 'AbC';
     $valueExpected = 'abc';
     $this->assertEquals($valueExpected, $this->_filter->filter($value));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:11,代码来源:FilterTest.php

示例3: saveImages

 private function saveImages($data, $promo)
 {
     if (isset($data['filePromo'])) {
         $relativeImageDir = '/customers/' . $data["userId"];
         $customerImageDir = IMAGE_PATH . $relativeImageDir;
         $form = $this->view->form;
         $adapter = $form->filePromo->getTransferAdapter();
         //create directory where files would be hold
         if (!is_dir($customerImageDir)) {
             mkdir($customerImageDir, 0777, 1);
         }
         $i = 0;
         $images = array();
         //loop uploaded files
         $files = $adapter->getFileInfo();
         foreach ($files as $file => $fileInfo) {
             $extension = substr(strrchr($fileInfo['name'], '.'), 1);
             $promoImageDir = $customerImageDir . '/' . $promo->getId();
             $imageName = $promoImageDir . '/image_' . $i . '.' . $extension;
             $imageName2 = $promoImageDir . '/thumb/image_' . $i . '.' . $extension;
             if (!is_dir($promoImageDir)) {
                 mkdir($promoImageDir, 0777, 1);
             }
             if (!is_dir($promoImageDir . '/thumb')) {
                 mkdir($promoImageDir . '/thumb', 0777, 1);
             }
             $adapter->addFilter('Rename', array('target' => $imageName, 'overwrite' => true));
             $filterChain = new Zend_Filter();
             $filterChain->appendFilter(new Skoch_Filter_File_Resize(array('width' => 300, 'height' => 300, 'keepRatio' => true)));
             $filterChain->appendFilter(new Skoch_Filter_File_Resize(array('directory' => $promoImageDir . '/thumb', 'width' => 60, 'height' => 60, 'keepRatio' => true)));
             $adapter->addFilter($filterChain);
             $images[] = $relativeImageDir . '/' . $promo->getId() . '/image_' . $i . '.' . $extension;
             /* TODO: resizing de la imagen
                $form->file->addFilter(new Skoch_Filter_File_Resize(array('width' => 200,'height' => 300,'keepRatio' => true,))); */
             if (!$adapter->receive($file)) {
                 $mensajes = $form->filePromo->getMessages();
                 throw new Exception('Error!!');
             }
             chmod($logoName, 0777);
             $i++;
         }
         /*foreach ($adapter->getFileInfo() as $info)
                     {     
                         $extension = substr(strrchr($info['name'],'.'),1);
                         
                         $promoImageDir = $customerImageDir.'/'.$promo->getId();
                         if(!is_dir($promoImageDir))
                             mkdir($promoImageDir, 0666, 1);
                         
                         $logoName = $promoImageDir.'/image_'.$i.'.'.$extension;
                                 
                         $adapter->addFilter('Rename', array('target'=>$logoName, 'overwrite'=>true));
         
                         $images[] =  $relativeImageDir.'/'.$promo->getId().'/image_'.$i.'.'.$extension;
                          TODO: resizing de la imagen
                         $form->file->addFilter(new Skoch_Filter_File_Resize(array('width' => 200,'height' => 300,'keepRatio' => true,))); 
                         if (!$form->images->receive()) {
                             $mensajes = $form->images->getMessages();
                             throw new Exception('Error!!');
                         }
                         chmod($logoName,0666);
                         $i++;    
                     } */
         $promo->saveImages($images);
     } else {
         $promo->loadImages($this->user);
     }
 }
开发者ID:redaumore,项目名称:promociones,代码行数:68,代码来源:PromotionController.php


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