首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用captcha时出现错误'Image corrupt or truncated‘

使用captcha时出现错误'Image corrupt or truncated‘
EN

Stack Overflow用户
提问于 2011-09-09 12:34:43
回答 2查看 3.8K关注 0票数 2

我正在使用codeigniter。在我的表单中,我使用验证码。一切正常,但现在它不能加载,当我检入firebug时,这个错误给出了

代码语言:javascript
复制
Image corrupt or truncated: http://localhost/elephanti//home/auth/get_capture/913472

这是我的控制器

代码语言:javascript
复制
function get_capture() {
    $this->auth_lib->get_capture_image ();
}

在我看来

代码语言:javascript
复制
                                            <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

代码语言:javascript
复制
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);
}

这是我的验证码模型

公共函数lmj_crate_image($path) {

代码语言:javascript
复制
$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();

}

我想不出这里有什么问题。这段代码可能没有什么帮助。

如果这没有帮助,你能告诉我不工作的可能原因吗?谢谢.

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-05 13:20:17

实际上,问题是我的一个库中有一个空格,在我删除了空格和php结束标记之后,现在它可以正常工作了,谢谢:)

票数 0
EN

Stack Overflow用户

发布于 2011-09-09 12:37:28

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

您是否重命名了图像的文件扩展名(例如,将.jpg更改为.png )?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7357186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档