我创建了具有动态颜色、字体、按钮大小的表单。当我提交表单时,按钮图像显示在整页中,我需要显示在第一页本身。
我的控制器代码:
public function creatorbuton(){
$button_size = $this->input->POST('button_size');
$font_style = $this->input->POST('font_style');
$color_schme = $this->input->POST('color_schme');
$textdisplay = $this->input->POST('textdisplay');
header('content-type: image/png');
//Create our basic image stream
//125px width, 125px height
$image = imagecreate(120, 60);
//Set the background color
$blue = imagecolorallocate($image, 150, 50, 105);
//Set up another color just to show how the first color declared is used as the background color when we use imagecreate()
//Notice how blue is applied to the background, *not* red.
$red = imagecolorallocate($image, 150, 200, 10);
//$font = myurl.'fonts/arial.ttf';
//$text="Hello";
//imagettftext($image, 20, 0, 11, 21, $red, $font, $text);
//save the image as a png and output
$result_array['final_image'] = imagepng($image);
//Clear up memory used
imagedestroy($image);
$this->load->view('buttonconfig/buttoncreator',$result_array);
如何在 buttoncreator 视图页面中显示按钮。当我使用取消注释此行时
imagettftext($image, 20, 0, 11, 21, $red, $font, $text);
我得到了这一行“图像我的 URL 无法显示,因为它包含错误”。