1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace Poster\Lib;
- use Dever;
- use Dever\Support\Img as Handle;
- class Img
- {
-
- public function create($config = array(), $filename = '', $type = 'gd', $update = 2)
- {
- $this->img = isset($this->img) ? $this->img : new Handle();
-
- 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);
- } else {
- return Dever::pic($file);
- }
- return $host . str_replace(DEVER_PROJECT_PATH, '', $file);
- $file = Dever::pic($file);
- return $file;
- }
- }
|