update($data); } return $id; } public function template() { $id = Dever::input('search_option_template_id'); $info = Dever::db('poster/template')->find($id); if ($info['create'] == 1) { # 生成空白背景图 $filename = 'background_' . $info['id']; $file = Dever::pathDay('upload/poster', false) . $filename . '.jpg'; $img = new Handle(); $img->create($file, $info['width'], $info['height'], 1); $info['background'] = Dever::pic($file); } //$info['background'] = Dever::local($info['background']); $info['background'] = "background-image:url('".$info['background']."');"; return $info; } public function model() { $where['template_id'] = Dever::input('search_option_template_id'); $data = Dever::db('poster/model')->select($where); if ($data) { foreach ($data as $k => $v) { $data[$k]['content'] = ''; $data[$k]['style'] = 'display:none;position:absolute;'; if ($v['type'] == 1) { $data[$k]['content'] = ''; $data[$k]['style'] .= 'width: '.$v['width'].'px;height:'.$v['height'].'px;'; } else { if (!$v['value']) { $v['value'] = $v['name']; } $data[$k]['content'] = $v['value']; $data[$k]['style'] .= 'width: '.$v['text_width'].'px;'; if ($v['color']) { $data[$k]['style'] .= 'color:' . $v['color'] . ';'; } if ($v['size']) { $data[$k]['style'] .= 'font-size:' . $v['size'] . 'px;'; } if ($v['fonts']) { //$data[$k]['style'] .= 'font-size:' . $v['size'] . ';'; } } $edit_link = Dever::url('project/database/update&project=poster&table=model&where_id=' . $v['id'], 'manage'); $del_link = Dever::url('database.delete_action&project=poster&table=model&where_id=' . $v['id'], 'manage'); $data[$k]['content'] .= '
'; $p = explode(',', $v['position']); $data[$k]['style'] .= 'left:'.$p[0].'px;top:'.$p[1].'px;'; } } return $data; } }