動的な色、フォント、ボタンのサイズでフォームを作成しました。フォームを送信すると、ボタン画像がページ全体に表示され、最初のページ自体に表示する必要があります。
私のコントローラーコード:
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);
ボタン作成者ビュー ページでボタンを表示する方法。この行のコメントを外したとき
imagettftext($image, 20, 0, 11, 21, $red, $font, $text);
「エラーが含まれているため、画像 MY URL を表示できません」という行が表示されました。