1)); } public function gets() { $name = "专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍专家介绍"; $name = Dever::addstr($name, 11, "11"); return ''; } public function get($name, $key, $set, $update = false, $num = 1) { if (strstr($key, ',') || is_numeric($key)) { $where['ids'] = $key; } else { $where['key'] = $key; } $template = Dever::db('poster/template')->getAll($where); $key = array_rand($template, 1); $template = $template[$key]; if ($template) { if (!$update) { $update = $template['update']; } $where = array(); $where['template_id'] = $template['id']; $model = Dever::db('poster/model')->state($where); if ($model) { $config = array(); $config['background'] = Dever::local($template['background']); $config['param'] = array(); foreach ($model as $k => $v) { $param = $this->getConfig($v, $set); if ($param) { array_push($config['param'], $param); } } if ($config['param']) { $result = Dever::load('upload/view')->create($config, $name, $template['type'], $update); return Dever::pic($result); } } else { return Dever::pic($template['background']); } } return false; } private function getConfig($value, $set) { $key = $value['key']; $param = array(); if (!isset($set[$key]) && $value['value']) { $set[$key] = $value['value']; } if (isset($set[$key])) { if ($value['position_type'] == 8) { $position = explode(',', $value['position']); } else { $position = $value['position_type']; } if ($value['type'] == 1) { $param['method'] = 'mark'; $param['water'] = $set[$key]; $param['position'] = $position; $param['width'] = $value['width']; $param['height'] = $value['height']; } elseif ($value['type'] == 2) { $param['method'] = 'txt'; $param['name'] = $set[$key]; $param['color'] = $value['color']; $param['position'] = $position; //$param['top'] = $position[1]; //$param['left'] = $position[2]; $param['size'] = $value['size']; $param['angle'] = $value['angle']; $fonts = array ( 1 => 'PingFang_Regular.ttf', 2 => 'PingFang_Bold.ttf', 3 => 'PingFang_Medium.ttf', ); $param['font'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '../fonts/'.$fonts[$value['fonts']]; } } return $param; } }