2011-09-09 50 views
2

我正在使用codeigniter。在我的表單中,我使用了驗證碼。所有工作正常,但現在沒有加載,當我在Firebug檢查這個錯誤給錯誤'圖像損壞或截斷'使用驗證碼時

Image corrupt or truncated: http://localhost/elephanti//home/auth/get_capture/913472 

這是我的控制器

function get_capture() { 
    $this->auth_lib->get_capture_image(); 
} 

在我看來

          <div 

class="form-item"> 
                <div class="catergory-inputs"> 
                 <div class="textarea-large-container" id="caption"> 
                  <img border="0" 
                   src="<?php echo $this->config->item('base_url'); ?>/home/auth/get_capture/<?php echo rand();?>" 
                   id="captcha" width="225" height="67" /> 
                 </div> 
                 <div class="caption-icon"> 
                  <img 
                   src="<?php echo $this->config->item('img_path') ?>/icon-caption.png" 
                   width="19" height="20" alt="icon-caption" 
                   style="cursor: pointer;" 
                   onclick="reload_chaptca('<?php echo $this->config->item('base_url'); ?>/home/auth/get_capture/','<?php echo rand();?>')" /> 
                 </div> 
                </div> 
               </div> 
在我aut_lib

public function get_capture_image() 
{ 
    $this->ci->load->model('captcha/captcha_model'); 
$path = APPPATH . '../../assets/3rd/captcha'; 
$this->ci->captcha_model->lmj_crate_image($path); 
} 

thi s是我的驗證碼模型

公共職能lmj_crate_image($ PATH){

$this->resourcesPath=$path; 
$ini = microtime(true); 

/** Initialization */ 
$this->lmj_reserved_image(); 

/** Text insertion */ 
$text = $this->lmj_get_the_captcha(); 
$fontcfg = $this->fonts[array_rand($this->fonts)]; 
$this->lmj_write_fonts($text, $fontcfg); 

$this->session->set_userdata($this->session_var, $text); 
// $_SESSION[$this->session_var] = $text; 

/** Transformations */ 
$this->lmj_render_image(); 
if ($this->blur && function_exists('imagefilter')) { 
    imagefilter($this->im, IMG_FILTER_GAUSSIAN_BLUR); 
} 
$this->lmj_low_resalution(); 


if ($this->debug) { 
    imagestring($this->im, 1, 1, $this->height - 8, 
      "$text {$fontcfg['font']} " . round((microtime(true) - $ini) * 1000) . "ms", 
      $this->GdFgColor 
    ); 
} 


/** Output */ 
$this->lmj_make_image_from_text(); 
$this->lmj_default_clean(); 

}

我想不出這裏有什麼問題。此代碼可能沒有幫助。

如果這沒有幫助,你可以告訴我不工作的可能原因。感謝...........

回答

0

實際上問題是我在我的一個庫中有一個空白區域,在刪除了空白區域並刪除了php結束標記後,現在它能正常工作,謝謝:)