Skip to main content

Images on product page not the correct size

More
11 years 5 months ago #200254 by hans2103
-- 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:
Code:
$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
Code:
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:
Code:
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.
Code:
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.

More
11 years 5 months ago #200257 by Xavier
Hi,

It seems that you don't have the latest version of the content, please replace the code in the helper cart by:
Code:
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.

More
11 years 5 months ago #200519 by hans2103
reinstall the upgrade seemed to work.

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

Time to create page: 0.192 seconds
Powered by Kunena Forum