kndwsu
kndwsu

Reputation: 381

display different image size in opencart php

I have following image names in my opencart directory /image/cache/data

1. 15-40x40.jpg
2. 15-62x62.jpg
3. 15-100x100.jpg
4. 15-160x160.jpg
5. 15-200x200.jpg
6. 15-455x475.jpg
7. 15-800x800.jpg

if i use echo $thumb it is showing the image 15-800x800.jpg but how can i call the image 15-100x100.jpg

Can any one help

Upvotes: 0

Views: 5186

Answers (2)

Sankar V
Sankar V

Reputation: 4128

The '800x800', '100x100' values shows the dimension of images. Opencart uses resized versions of original images in its webpages. You can change the image dimensions in opencart admin: System > Settings > Store [Edit] > Image tab. The option that you're searching for may be Product Image Thumb Size: in Image tab.

Upvotes: 1

shadyyx
shadyyx

Reputation: 16055

Images (thumbnails) are often created by code similar to this on:

$this->data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));

(this is for the category image on category page). Here the width and height sizes are comming from DB, table setting, or in other words You can set them in You admonistration - System -> Setting - edit store, tab Image.

But if You need to do this in certain modules differently and do not want to create a new setting for this (since You know You won't change this in near future or not so often), You can simply call Your thumb as this:

$this->data['thumb'] = $this->model_tool_image->resize($category_info['image'], 100, 100);

Change that $this->data['thumb'] and $category_info['image'] parts in Your controller to meet Your needs...

Upvotes: 0

Related Questions