I'm pretty sure I'm just overthinking this but I can't think of any other ways right now.
I have a hidden field that contains image_ids. The value of the hidden field looks like "1076,1077,1078"
In my Controller, I am doing this:
// get the value from hidden field
$image_string = $this->input->post('images');
// create array from comma separated string
$images = explode(',', $image_string);
$image = array();
// get image data from the database, returns an array of the database row
foreach ($images as $id) {
$image[$id] = $this->file_model->get_image_data($id);
}
print_r($image);
When I do the print_r(image); at the end, I get this:
Array (
[0] => stdClass Object ( [image_id] => 1076 )
[1] => stdClass Object ( [image_id] => 1077 )
[2] => stdClass Object ( [image_id] => 1078 )
)
This is where I'm stuck. I need to do another foreach to echo out each image_id, but I can't figure out how to call it. What should the 2nd foreach look like?