| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | 
							- <?php
 
- namespace Poster\Lib;
 
- use Dever;
 
- use Dever\Support\Img as Handle;
 
- class Img
 
- {
 
-     /**
 
-      * create 生成图片
 
-      * @param array $config
 
-      * @param string $filename
 
-      *
 
-      * @return mixed
 
-      */
 
-     public function create($config = array(), $filename = '', $type = 'gd', $update = 2)
 
-     {
 
-         $this->img = isset($this->img) ? $this->img : new Handle();
 
-         /*
 
-         $config = array
 
-         (
 
-             'background' => '/www/grow/data/upload/1/2018/07/19/a49fe8914df0eada4d4b7d530d7fa5ba.jpg',
 
-             'param' => array
 
-             (
 
-                 0 => array
 
-                 (
 
-                     'method' => 'mark',
 
-                     'water' => '/www/grow/data/upload/1/2018/07/19/46d5b0c5c25c800cf197ea4f64f503f2.jpg',
 
-                     //left,top
 
-                     'position' => array(100,200),
 
-                     'width' => 100,
 
-                     'height' => 100,
 
-                 ),
 
-                 1 => array
 
-                 (
 
-                     'method' => 'txt',
 
-                     'name' => 'test文字',
 
-                     'color' => '#FF0000',
 
-                     'position' => array(100,200),
 
-                     'size' => 50,
 
-                     'angle' => 0,
 
-                     'font' => '/www/grow/config/fonts/simsun.ttc',
 
-                 ),
 
-             ),
 
-         );
 
-         */
 
-         if (!$filename) {
 
-             $filename = Dever::id();
 
-         }
 
-         $file =  Dever::pathDay('upload/poster', false) . md5($filename) . '.jpg';
 
-         if (!is_file($file) || $update == 1) {
 
-             $this->img->setType($type);
 
-             $result = $this->img->init($config['background'], $config['param'], true, $file);
 
-             if ($result) {
 
-                 $file = array_pop($result);
 
-             }
 
-         } else {
 
-         }
 
-         $host = str_replace(DEVER_PROJECT . '/' . DEVER_APP_NAME . '/', '', Dever::config('host')->base);
 
-         if (strstr($file, '/share/dc/data/')) {
 
-             return $host . str_replace('/share/dc/data/', '', $file);
 
-         }
 
-         return $host . str_replace(DEVER_PROJECT_PATH, '', $file);
 
-         $file = Dever::pic($file);
 
-         return $file;
 
-     }
 
- }
 
 
  |