dpsx99068 2015-09-18 10:02
浏览 171

如何在opencart中获取产品图片的确切网址?

I got products from product and product_description tables. I also found image column in product table. But I can't get resized images? How can I?

Thanks in Advance..

  • 写回答

1条回答 默认 最新

  • doupuchen6378 2015-09-19 02:25
    关注

    Resized images are stored in image/cache/ folder.

    Resized images are created only when resize method is called. Like in catalog/controller/product/product.php you can see following code which will resize the main image.

    $this->load->model('tool/image');
    
            if ($product_info['image']) {
                $data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
            } else {
                $data['popup'] = '';
            }
    

    Here the resize method takes database product's table image field and height and width given in setting of admin.

    This will create resized image at image/cache/"IF ANY FOLDER"/ and the name of the image will be like "NAME_OF_THE_IMAGE"-width*height."EXTENSION_OF_IMAGE"

    For eg: If you product table's image column holds catalog/demo/imac.jpg then you resize it with width=100 and height=100 then it will be cache/catalog/demo/imac-100*100.jpg

    Take into consideration that resized images are created only when you load the controller, once it is created it will be there.

    So taking your problem into consideration, you have to recreate your image urls as described above and create resized images(only if you need images also).

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)