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


PHP elFinder::isAnimationGif方法代码示例

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


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

示例1: onUpLoadPreSave

 public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume)
 {
     $opts = $this->opts;
     $volOpts = $volume->getOptionsPlugin('Watermark');
     if (is_array($volOpts)) {
         $opts = array_merge($this->opts, $volOpts);
     }
     if (!$opts['enable']) {
         return false;
     }
     $srcImgInfo = @getimagesize($src);
     if ($srcImgInfo === false) {
         return false;
     }
     // check Animation Gif
     if (elFinder::isAnimationGif($src)) {
         return false;
     }
     // check water mark image
     if (!file_exists($opts['source'])) {
         $opts['source'] = dirname(__FILE__) . "/" . $opts['source'];
     }
     if (is_readable($opts['source'])) {
         $watermarkImgInfo = @getimagesize($opts['source']);
         if (!$watermarkImgInfo) {
             return false;
         }
     } else {
         return false;
     }
     $watermark = $opts['source'];
     $marginLeft = $opts['marginRight'];
     $marginBottom = $opts['marginBottom'];
     $quality = $opts['quality'];
     $transparency = $opts['transparency'];
     // check target image type
     $imgTypes = array(IMAGETYPE_GIF => IMG_GIF, IMAGETYPE_JPEG => IMG_JPEG, IMAGETYPE_PNG => IMG_PNG, IMAGETYPE_WBMP => IMG_WBMP);
     if (!($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) {
         return false;
     }
     // check target image size
     if ($opts['targetMinPixel'] > 0 && $opts['targetMinPixel'] > min($srcImgInfo[0], $srcImgInfo[1])) {
         return false;
     }
     $watermark_width = $watermarkImgInfo[0];
     $watermark_height = $watermarkImgInfo[1];
     $dest_x = $srcImgInfo[0] - $watermark_width - $marginLeft;
     $dest_y = $srcImgInfo[1] - $watermark_height - $marginBottom;
     if (class_exists('Imagick')) {
         return $this->watermarkPrint_imagick($src, $watermark, $dest_x, $dest_y, $quality, $transparency, $watermarkImgInfo);
     } else {
         return $this->watermarkPrint_gd($src, $watermark, $dest_x, $dest_y, $quality, $transparency, $watermarkImgInfo, $srcImgInfo);
     }
 }
开发者ID:amoskarugaba,项目名称:sakai,代码行数:54,代码来源:plugin.php

示例2: resize

 /**
  * Resize image
  *
  * @param  string   $hash    image file
  * @param  int      $width   new width
  * @param  int      $height  new height
  * @param  int      $x       X start poistion for crop
  * @param  int      $y       Y start poistion for crop
  * @param  string   $mode    action how to mainpulate image
  * @return array|false
  * @author Dmitry (dio) Levashov
  * @author Alexey Sukhotin
  * @author nao-pon
  * @author Troex Nevelin
  **/
 public function resize($hash, $width, $height, $x, $y, $mode = 'resize', $bg = '', $degree = 0)
 {
     if ($this->commandDisabled('resize')) {
         return $this->setError(elFinder::ERROR_PERM_DENIED);
     }
     if (($file = $this->file($hash)) == false) {
         return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
     }
     if (!$file['write'] || !$file['read']) {
         return $this->setError(elFinder::ERROR_PERM_DENIED);
     }
     $path = $this->decode($hash);
     $work_path = $this->getWorkFile($this->encoding ? $this->convEncIn($path, true) : $path);
     if (!$work_path || !is_writable($work_path)) {
         if ($work_path && $path !== $work_path && is_file($work_path)) {
             @unlink($work_path);
         }
         return $this->setError(elFinder::ERROR_PERM_DENIED);
     }
     if ($this->imgLib != 'imagick') {
         if (elFinder::isAnimationGif($work_path)) {
             return $this->setError(elFinder::ERROR_UNSUPPORT_TYPE);
         }
     }
     switch ($mode) {
         case 'propresize':
             $result = $this->imgResize($work_path, $width, $height, true, true);
             break;
         case 'crop':
             $result = $this->imgCrop($work_path, $width, $height, $x, $y);
             break;
         case 'fitsquare':
             $result = $this->imgSquareFit($work_path, $width, $height, 'center', 'middle', $bg ? $bg : $this->options['tmbBgColor']);
             break;
         case 'rotate':
             $result = $this->imgRotate($work_path, $degree, $bg ? $bg : $this->options['tmbBgColor']);
             break;
         default:
             $result = $this->imgResize($work_path, $width, $height, false, true);
             break;
     }
     $ret = false;
     if ($result) {
         $stat = $this->stat($path);
         clearstatcache();
         $fstat = stat($work_path);
         $stat['size'] = $fstat['size'];
         $stat['ts'] = $fstat['mtime'];
         if ($imgsize = @getimagesize($work_path)) {
             $stat['width'] = $imgsize[0];
             $stat['height'] = $imgsize[1];
             $stat['mime'] = $imgsize['mime'];
         }
         if ($path !== $work_path) {
             if ($fp = @fopen($work_path, 'rb')) {
                 $ret = $this->saveCE($fp, $this->dirnameCE($path), $this->basenameCE($path), $stat);
                 @fclose($fp);
             }
         } else {
             $ret = true;
         }
         if ($ret) {
             $this->rmTmb($file);
             $this->clearcache();
             $ret = $this->stat($path);
             $ret['width'] = $stat['width'];
             $ret['height'] = $stat['height'];
         }
     }
     if ($path !== $work_path) {
         is_file($work_path) && @unlink($work_path);
     }
     return $ret;
 }
开发者ID:radumargina,项目名称:webstyle-antcr,代码行数:89,代码来源:elFinderVolumeDriver.class.php


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