Reputation: 2729
I'm trying to load a captcha image passing controller to view.The code of my controller
$captcha_data['image'] = $this->captcha_security_model->get_captcha($width,$height,$characters);
// header('Content-Type: image/jpeg');
// imagejpeg($captcha_data['image']);
// imagedestroy($captcha_data['image']);
$this->load->view('captcha_view',$captcha_data);
Uncommenting that three line showing the image in full page mode.The code of my view:
<?php
echo $image;
?>
<img src="" />
<form action="" method="post">
<input type="text" name="word" />
<input type="submit" name="submit" value="submit" />
</form>
Loading from view is somehow failed.This code gives me this:
Upvotes: 0
Views: 946
Reputation: 2670
You don't need to pass image to the view. Just out put image in 'full page mode' INSIDE CONTROLLER and in a view file put something like <img src='htttp://mysite.com/captchaimage/controller/'>
Upvotes: 1