Mukesh Ravi Posted July 10, 2013 Share Posted July 10, 2013 Hello Everybody, I am using PS 1.5.4.1 I have create a new images variable (newproductimage) and set it's dimention 160x272. and have regenerated product images in correspondence to new image variable. Now when I am using this variable in product.tpl file then it's working for for image src but when I an specifying image height (newproductimageSize.height) and image width (newproductimageSize.width) it is not working. I am not getting why this is happening. I have used this type of things successfully for older versions. But unfortunately nit working for PS1.5.4.1 Any solution ....???? Link to comment Share on other sites More sharing options...
NemoPS Posted July 10, 2013 Share Posted July 10, 2013 Hi, Those variables must be assigned by either a module (in the left column or top of pages hook) or the productFrontController before thay can be used in the page Link to comment Share on other sites More sharing options...
vekia Posted July 10, 2013 Share Posted July 10, 2013 it's necessary to define new image size in the controller. in this case i mean the "productController.php" located in the controllers/front/ dir you've got there: $this->context->smarty->assign(array( 'have_image' => isset($cover['id_image'])? array((int)$cover['id_image']) : Product::getCover((int)Tools::getValue('id_product')), 'cover' => $cover, 'imgWidth' => (int)$size['width'], 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'largeSize' => Image::getSize(ImageType::getFormatedName('large')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'col_img_dir' => _PS_COL_IMG_DIR_)); define your new imagetype, just append it to array 1 Link to comment Share on other sites More sharing options...
NemoPS Posted July 10, 2013 Share Posted July 10, 2013 If you don't want to edit the controller you can apply vekia's method to a module as well (say, you can create a configuration module for your theme) 1 Link to comment Share on other sites More sharing options...
vekia Posted July 10, 2013 Share Posted July 10, 2013 that's right, Nemo's suggestion is much better. It's better to override the controller or to apply code to the module Link to comment Share on other sites More sharing options...
Mukesh Ravi Posted July 10, 2013 Author Share Posted July 10, 2013 Hello, I have tried with overriding "productController.php". but no result. any other solutions? Also if I need to create configuration module then Admin need to edit the variables value also if he change image size variable value. Link to comment Share on other sites More sharing options...
NemoPS Posted July 10, 2013 Share Posted July 10, 2013 ? The image size is taken in the module using Vekia's method so it's absolutely dynamic, you don't have to set it every time Link to comment Share on other sites More sharing options...
Recommended Posts