Thumbnail Path and size configuration issue

  • Posts: 4
  • Thank you received: 0
9 years 4 months ago #237292

Hi,

We are using Hikashop 2.6.2. We are facing an issue with product thumbnail. I am setting the thumbnail height and width as 170x170 but it always saves it under 100x100 no matter what size i mentioned under "Thumbnail height and width" under "Files" section of configuration. I also looked into the image helper code in administrator component for hikashop and found that inside upload controller, image helper function $imageHelper->getThumbnail() is being called with second parameter as array(100,100) and when i looked into the definition of the getThumbnail function found that you have added three conditions as:

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

and first and second condition is false and it goes to third condition where is check if $size('x') is empty which is true and then it set the $size[x]=$size[0]// which you passed hardcoded while calling getThmbnail function in upload controller so it always put the thumbnails in 100x100 folder regardless of you setting in admin configuration. It should pick the value from config array as $config->get('thumbnail_x', 100); not hardcoded.

Can you please suggest what i should do if i need to change thumbnail path? As far as i know thumbnail folder should be created with the name by getting the thumbnail height and with of the thumbnail from admin configuration.

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #237304

Hi,

Different views will use different thumbnails size. For example, in the emails the thumbnails are generated with 50*50 because it is more adapted to the width available in emails.
Of course, you can change the size for each view independently. The setting in the HikaShop configuration is just the main default setting for the listings of products, its role isn't to be applied to all the thumbnails that are generated.
For example, when you edit a menu item or a module via the Joomla menus/modules manager, under the "products options"/"HikaShop options" tab, you'll find an "image width" and an"image height" parameters that will override the setting in the configuration. That way, you can use different thumbnails sizes for different listings.
So no, it's not a matter of being hardcoded and that the system should always use the configuration setting. It's just that the size comes from the view. And since we don't know what view you're talking about, I can't tell you where you should look to modify the size.

Last edit: 9 years 4 months ago by nicolas.

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

  • Posts: 4
  • Thank you received: 0
9 years 4 months ago #237458

nicolas, Thanks for you reply,

I am talking about the product images when we add a product from hikashop admin. I have defined the thumbnail height and width s 165 in hikashop configuration. When i add a product from hikashop backend and upload a image then it should create a product thumbnail of 165x165 under folder /thumbnail/165x165 but it is creating a thumbnail of 100x100 under folder 100x100. or in other words i want to create a thumbnail of 165x165 when we upload a product image from hikashop backend . how we would do that. thats my concern. Please see the attached images for you references

Thanks

Attachments:
Last edit: 9 years 4 months ago by rakeshSaharan.

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #237478

Hi,

As I said, that setting is only for the listings of your frontend. So it's normal that the thumbnails in the uploader don't use that parameter.
If you want to change the size of these thumbnails you need to change the lines:

$img = $imageHelper->getThumbnail($file->file_path, array(100, 100), array('default' => true));
to:
$img = $imageHelper->getThumbnail($file->file_path, array(165, 165), array('default' => true));
in the file administrator/components/com_hikashop/controllers/upload.php

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

  • Posts: 4
  • Thank you received: 0
9 years 4 months ago #237628

Nicolas,

I am also talking about frontend listing as well. and Do you mean when we add product and upload image in admin it always create 100x100 thumbnail not according to settings ? If you are correct then there is no way to change the thumbnail size in admin apart from making changes in code ?

Moreover if we make changes in code it will be overwrite when we update the hikashop .

Last edit: 9 years 4 months ago by rakeshSaharan.

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #237640

Hi,

I am also talking about frontend listing as well

As I said, the system can create different thumbnails for different places where the images have to be displayed. For the frontend listings, edit the settings of your menu items/modules via the Joomla menus/modules manager and you'll find "image width" and "image height" settings to change the size you want for each menu/module.

Do you mean when we add product and upload image in admin it always create 100x100 thumbnail not according to settings ? If you are correct then there is no way to change the thumbnail size in admin apart from making changes in code ?

That's right.

Moreover if we make changes in code it will be overwrite when we update the hikashop

Yes, you'll loose the change when you update if you do it like I said.
What you could do is use a template class override:
www.hikashop.com/forum/checkout/878018-c...asses-field-php.html
But I wouldn't bother for the thumbnail size of the uploader system in the backend... It won't change anything to the images on your frontend anyway.

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

  • Posts: 4
  • Thank you received: 0
9 years 4 months ago #238036

Thanks Nicolas,

We are not using the hikashop frontend, we have our custom shopping card for frontend. and we want to display the thumbnail folder path to be 165x165 instead of 100x100. We can change the path on frontend but problem is thumbnail is being created in 100x100 folder. we just want to change that to create thumbnail in 165x165 when uploading product from hikashop frontend.

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #238090

Hi,

So in that case, you can do like explained before: create an override of that class and do the modification I mentioned in that override and you'll be set.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum