Jump to content

Image width and height is not getting


Recommended Posts

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

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

  • Like 1
Link to comment
Share on other sites

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

×
×
  • Create New...