Images on product page not the correct size

  • Posts: 17
  • Thank you received: 1
10 years 4 months ago #200254

-- url of the page with the problem -- : localhost
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4
-- Error-message(debug-mod must be tuned on) -- : array(2) { ["width"]=> int(300) ["height"]=> int(200) }
array(2) { ["x"]=> int(150) ["y"]=> int(100) }
array(2) { ["x"]=> int(150) ["y"]=> int(100) }
array(2) { ["x"]=> int(150) ["y"]=> int(100) }

  • Catalog view I see image size = 150x100. As set in configuration
  • Product view I see image size = 150x100. I was expecting to see 300x200 as set in configuration

looking at components/com_hikashop/views/product/tmpl/show_block_img.php
line 63:
$img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
an array is set with width and height
this is used for function getThumbnail

looking at administrator/components/com_hikashop/helpers/image.php
around line 376 in function getThumbnail
if(empty($size) || !is_array($size) || (!isset($size['x']) && !isset($size[0])))
$size = array('x' => (int)$config->get('thumbnail_x', 100), 'y' => (int)$config->get('thumbnail_y', 100));
if(isset($size['width']))
$size = array('x' => (int)$size['width'], 'y' => (int)$size['height']);
if(!isset($size['x']))
$size = array('x' => (int)$size[0], 'y' => (int)$size[1]);

I've changed it to:
var_dump($size);
if(empty($size) || !is_array($size) || (!isset($size['x']) && !isset($size[0])))
$size = array('x' => (int)$config->get('thumbnail_x', 100), 'y' => (int)$config->get('thumbnail_y', 100));
var_dump($size);
if(isset($size['width']))
$size = array('x' => (int)$size['width'], 'y' => (int)$size['height']);
var_dump($size);
if(!isset($size['x']))
$size = array('x' => (int)$size[0], 'y' => (int)$size[1]);
var_dump($size);

after reloading product detail page I get the following just before the image.
array(2) { ["width"]=> int(300) ["height"]=> int(200) } 
array(2) { ["x"]=> int(150) ["y"]=> int(100) } 
array(2) { ["x"]=> int(150) ["y"]=> int(100) } 
array(2) { ["x"]=> int(150) ["y"]=> int(100) }

In the first if-then-else statement the $size var is overriden with new data and my configured width and height are gone

is this a bug? Or did I miss a very obvious setting?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 4 months ago #200257

Hi,

It seems that you don't have the latest version of the content, please replace the code in the helper cart by:

		if(empty($size) || !is_array($size) || (!isset($size['x']) && !isset($size[0]) && !isset($size['width'])))
			$size = array('x' => (int)$config->get('thumbnail_x', 100), 'y' => (int)$config->get('thumbnail_y', 100));
		if(isset($size['width']))
			$size = array('x' => (int)$size['width'], 'y' => (int)$size['height']);
		if(!isset($size['x']))
			$size = array('x' => (int)$size[0], 'y' => (int)$size[1]);

The following user(s) said Thank You: hans2103

Please Log in or Create an account to join the conversation.

  • Posts: 17
  • Thank you received: 1
10 years 4 months ago #200519

reinstall the upgrade seemed to work.

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum