M
M
matros972018-03-23 10:42:39
opencart
matros97, 2018-03-23 10:42:39

How to get image path in controller?

Hello, I need to display a category image in category.tpl modules.
I got into the category.php controller

$data['categories'][] = array(
        'category_id' => $category['category_id'],
        'name'        => $category['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
        'children'    => $children_data,
        'href'        => $this->url->link('product/category', 'path=' . $category['category_id']),

        'image' => $category['image'],
      );

I wrote the line 'image' => $category['image'], since images are stored in the database, it displays the file name, but I can’t figure out how to set the path to the image?
The image field only stores the filename.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2018-03-24
@zoozag

$this->image->resize look in the same document

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question