I prefer to rename images files when uploaded and store them into db row related to his own parent (user,product,) ... then upload them into 3 folder:
/uploads
/img
/products
/small
/medium
/xxl
resizing them into small (50x50) , medium (90x90), xxl (original dimension), before moving them into these directories.
if you need SEO images you can store them for example:
id | product | image
1 book 1-book.png
so you'll get id and product name in same image file.
or you can even just store
id | product | image
1 book 1.png
then is simple to attach src paths :
/*Config file*/
$config['base_static_products_url'] = 'uploads/img/products/';
/*View file*/
<img src="<?php echo base_url().$this->config->config['base_static_products_url'].'/small/'.$row->image ?>" alt=""/>
OR (no SEO)
<img src="<?php echo base_url().$this->config->config['base_static_products_url'].'/small/'.$row->id.'.png' ?>" alt=""/>