Welcome Guest, Not a member yet? Register   Sign In
Why is Image_lib not displaying errors ?
#1

[eluser]vincej[/eluser]
Hi - I think I followed the user guide closely in my implementation of Image_lib, yet, I'm obviously doing something wrong as I do not get any errors displayed. I do get an error in the logs. Am I not supposed to get an error in my view ? The rest of my code works fine.

What am I doing wrong ?

Here is the relevant segment from my controller:

Code:
else{
$this->MBlog->recipie_submit($_POST);
if ( ! $this->image_lib->resize())
{

   echo $this->image_lib->display_errors();
  
}


Many thanks !!
#2

[eluser]vincej[/eluser]
I should have added that this code lives in my controller ... I don't get why CI echos errors out of a controller. I should have submitted the complete code - here it is:

Controller:

Code:
function recipie_submit(){

  $this->form_validation->set_rules('title', 'Title', 'required');
  $this->form_validation->set_rules('summary', 'Summary', 'required');
  $this->form_validation->set_rules('recipie_body', 'Body', 'required');
  $this->form_validation->set_rules('createuser', 'User Name', 'required');

if ($this->form_validation->run() == FALSE)
{
  $data['title'] = "Recipies";
  $data['main'] = 'create_recipies';
  $data['navlist'] = $this->MCats->getCategoriesNav();
  $this->load->vars($data);
  $this->load->view('template');
}
  
else{
$this->MBlog->recipie_submit($_POST);
if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
    
}
$this->session->set_flashdata('message','Thank You For Your Submission. It Will be Reviewed and Published within 48 hours' );
redirect('blog/indexRecipies'); }
}






#3

[eluser]Aken[/eluser]
It does, you apparently just aren't receiving any.

Pick apart the function itself and figure out where it's doing something that you aren't expecting.
#4

[eluser]vincej[/eluser]
thanks Aken - sure I accept that it does .. I just do not understand what I am doing wrong and why it is not coming out for me, or at least it is coming out but only in my log files, not as I would expect in my view.

Firstly, I do not understand why the class is echoing something out from the controller ... I'm concerned that when I do get it working I will get a header problem.

Secondly, I would like to present the warnings in my view - the user guide does not tell me how to do this.

thanks.
#5

[eluser]Aken[/eluser]
The Image_lib class doesn't echo anything - you're the one telling it to echo something in the controller. If you want to pass it to the view, do it like you would pass anything else. Read the user guide section on Views if you need assistance with that.

If you aren't receiving any errors, that means the library isn't generating any errors, which means either it isn't processing the image in the way you expect (or it isn't processing it at all for whatever reason), or it's working fine and you don't realize it.

Try removing the redirect for the time being, until it's working in the way you expect.




Theme © iAndrew 2016 - Forum software by © MyBB