PHP/Codeigniter – For Loop [Undefined offset]-Collection of common programming errors

By using a for loop you are assuming that the keys of the array are contiguous, which they may not be. You are also assuming that every second level array has a full_path key, which it may not. Use foreach instead, and do an isset() check on the full_path key:

foreach ($status as $item)
{

    if (!isset($item['full_path'])) continue;

    $conf = array(
        'source_image' => $item['full_path'],
        'new_image' => $this->upload_path . '/thumbs',
        'maintain_ratio' => true,
        'width' => 200,
        'height' => 200
    );

    $this->load->library('image_lib', $conf);
    $this->image_lib->resize();

    $this->image_lib->clear(); // complete reset    
    $this->image_lib->initialize($conf); // complete reset
}

Originally posted 2013-11-09 23:19:22.