开发者

Error 'Image corrupt or truncated' when using captcha

开发者 https://www.devze.com 2023-04-03 12:45 出处:网络
i am using codeigniter . in my form i am using a captcha . all worked fine ,but now it is not loading , when i checked in firebug this error gives

i am using codeigniter . in my form i am using a captcha . all worked fine ,but now it is not loading , when i checked in firebug this error gives

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

this is my controller

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

in my view

                                            <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>

in my 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);
}

this is my captcha model

public function 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();

}

i can not figure out what is the problem here . this code may not be helpful .

if this is not helpful can you tell me possible reasons for not working this . thank开发者_如何学JAVAs...........


http://blog.grahamlicence.co.uk/post/preventing-image-corrupt-or-truncated-error-in-firebug.aspx

Have you renamed an image's file extension (changed .jpg to .png for example) at all?


actually the issue was i had a white space in one of my libraries , after i removed the white space and removed the php closing tag , now it works correctly , thanks :)

0

精彩评论

暂无评论...
验证码 换一张
取 消