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


PHP Configure::where方法代码示例

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


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

示例1: __getImage

 private static function __getImage($img, $type)
 {
     $client = new Client(Config::get('services.dropbox.token'), Config::get('services.dropbox.appName'));
     $fileSystem = new Filesystem(new DropboxAdapter($client, '/images/'));
     $biggerW = $biggerH = false;
     if ($img->width > $img->height) {
         $biggerW = true;
     } else {
         $biggerH = true;
     }
     $image = $w = $h = null;
     $public_path = public_path($img->path);
     //code minh
     //get image from dropbox
     if ($img->store == 'dropbox') {
         try {
             $file = $fileSystem->read($img->path);
             $public_path = $file;
         } catch (Exception $e) {
             return false;
         }
     }
     //end code
     if (in_array($type, ['with-logo', 'large-thumb'])) {
         if ($biggerW) {
             $w = 450;
         } else {
             $h = 450;
         }
     } else {
         if (in_array($type, ['thumb', 'small-thumb'])) {
             if ($type == 'thumb') {
                 if ($biggerW) {
                     $w = 150;
                 } else {
                     $h = 150;
                 }
             } else {
                 if ($biggerW) {
                     $w = 100;
                 } else {
                     $h = 100;
                 }
             }
         } else {
             if (in_array($type, ['crop', 'newcrop'])) {
                 $h = 300;
                 $w = 300;
                 if ($type == 'newcrop') {
                     $w = 600;
                 }
             }
         }
     }
     try {
         if (in_array($type, ['crop', 'newcrop'])) {
             $image = Image::make($public_path)->fit($w, $h, function ($constraint) {
                 $constraint->aspectRatio();
             });
         } else {
             $image = Image::make($public_path)->resize($w, $h, function ($constraint) {
                 $constraint->aspectRatio();
             });
         }
     } catch (Exception $e) {
         return false;
     }
     if ($type == 'with-logo') {
         if (Cache::has('mask')) {
             $mask = Cache::get('mask');
         } else {
             $mask = Configure::where('ckey', 'mask')->pluck('cvalue');
             if (empty($mask)) {
                 $mask = 'Visual Impact';
             }
             Cache::forever('mask', $mask);
         }
         $size = 50;
         $w = $image->width();
         $h = $image->height();
         $x = round($w / 2);
         $y = round($h / 2);
         $img = Image::canvas($w, $h);
         $string = wordwrap($mask, 15, '|');
         $strings = explode('|', $string);
         $line = 2;
         $i = round($y - count($strings) / 2 * ($size + $line));
         $from = $i - 20;
         foreach ($strings as $string) {
             $draw = new \ImagickDraw();
             $draw->setStrokeAntialias(true);
             $draw->setTextAntialias(true);
             $draw->setFont(public_path('assets' . DS . 'fonts' . DS . 'times.ttf'));
             $draw->setFontSize($size);
             $draw->setFillColor('rgb(0, 0, 0)');
             $draw->setFillOpacity(0.2);
             $draw->setTextAlignment(\Imagick::ALIGN_CENTER);
             $draw->setStrokeColor('#fff');
             $draw->setStrokeOpacity(0.2);
             $draw->setStrokeWidth(1);
//.........这里部分代码省略.........
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:101,代码来源:VIImage.php


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