2012-04-11 4 views
0

php (codeigniter)를 사용하여 이미지를 만들어야하고 브라우저에 표시해야합니다. 나는 그것이 오류를 보여주는 http://localhost/tvc/index.php/get_captcha라고 할 때 나는 클래스는 은 (는) codeigniter에서 만들어진 이미지를 보여줍니다.

어느 하나 제발 도와주세요 ..

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

// class Welcome extends CI_Controller { 


    class Get_captcha extends CI_Controller { 

function __construct() 
{ 
    parent::__construct(); 
    $this->load->library('session'); 
    $this->load->library('form_validation'); 
    $this->load->helper(array('form', 'url')); 

} 

function index() 
{ 

// header('Content-Type: image/png'); 
Header("Content-type: image/png"); 
// Create the image 
$im = imagecreatetruecolor(400, 30); 

// Create some colors 
$white = imagecolorallocate($im, 255, 255, 255); 
$grey = imagecolorallocate($im, 128, 128, 128); 
$black = imagecolorallocate($im, 0, 0, 0); 
imagefilledrectangle($im, 0, 0, 399, 29, $white); 

// The text to draw 
$text = 'Testing...'; 
// Replace path by your own font path 
$font = 'verdana.ttf'; 

// Add some shadow to the text 
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); 

// Add the text 
imagettftext($im, 20, 0, 10, 20, $black, $font, $text); 

// Using imagepng() results in clearer text compared with imagejpeg() 
imagepng($im); 
imagedestroy($im); 


} 



    } 

다음과 같이있어?

감사

+1

오류가 무엇을 가지고? – cchana

+1

404 오류를 찾을 수 없습니다? –

+0

오류입니다 .. 이미지 "http : //localhost/tvc/index.php/get_captcha canot 오류가 포함되어 있기 때문에 표시 할 수 없습니다 – ramesh

답변

1

대부분의 경우 오류가 발견되지 verdana.ttf 함께 할 수있는 뭔가 ...

+0

예 경로가 정확합니다 – ramesh

관련 문제