Concatenate image path with codeigniter

-1

I have my query that returns

"products": [
                    {
                        "id": "1",
                        "name": "entrada p 1",
                        "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                        "image": "notfound.png",
                        "stock": null,
                        "reputation": "5",
                        "persons": "1",
                        "time": "15 minutos",
                        "tags": [
                            {
                                "id": "1",
                                "tag": "Sin taac",
                                "image": null
                            },

You can see a value image but how can I concatenate my complete url before? that is: http//site_url()/notfound.png

I leave my code of products :

function item_prodructs($category,$restaurant){

$this->db->select('p.id,p.name,p.description,p.image,p.stock,p.reputation,p.persons,p.time');
$this->db->from('products_categorize z');
$this->db->join('products p','z.idproduct = p.id');
$this->db->where('z.idcategory',$category);
$this->db->where('z.idsubcategory',null);
$this->db->where('p.restaurant',$restaurant);
$categorias = $this->db->get()->result_array();

return $categorias;
}
  

How can I manipulate the query to modify the image value with a full path using base_url ()?

    
asked by DoubleM 11.06.2018 в 16:23
source

1 answer

0

You could use CONCAT.

$this->db->select('p.id,p.name,p.description,CONCAT('.base_url().',p.image) as imagen,p.stock,p.reputation,p.persons,p.time',FALSE);

Greetings

    
answered by 11.06.2018 в 17:10