More thumbnail size

  • Posts: 2
  • Thank you received: 0
13 years 7 months ago #14366

Hi,
I'm currently working on a product page. And I want to show images of my product in another size than the one I defined in my configuration.

I have done this chunk of code, but I don't think it was the best way to do that :

$image = hikashop::get('helper.image');
$size = getimagesize($image->uploadFolder.$p->images[0]->file_path);
$image->width = $size[0];
$image->height = $size[1];
$image->_resizeImage($p->images[0]->file_path,$resize,$resize/$size[0]*$size[1],$dstFolder,"image");

Is there a better way to do that ?
I didn't found a function to do that in a simpler way.

Thanks for your answers.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
13 years 7 months ago #14372

Hi,

You should be able to put different thumbnail sizes between the listing and product page with CSS like that: www.hikashop.com/en/support/forum/4-how-...duct-page.html#10151

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

  • Posts: 2
  • Thank you received: 0
13 years 7 months ago #14374

I don't want to use a CSS solution for obvious image weight problems.
Some page will contains a lot of these images and I don't want to have longer loading than needed for my users.

I want to generate a new image file and not resize on the client side one existing.
My code here seems to do that but it seems to generates images files everytime it loads and seems kind of "hacky".
I can check the existance of an image to generate it or not but it would have been better to have a function in the helper that does that. If it's not currently possible, I ask it as a new feature.

Thanks.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
13 years 7 months ago #14375

In that case yes, you need to add some code to the views for that.
What you could do is change the uploadFolder path attributes of $image before calling the display function so that the thumbnails of the product page are stored in another folder than the default thumbnail folder and add some code to set your thumbnails size in $image. Then, you can keep the normal display function which will check for the thumbnail in your folder and generate it if missing before displaying it.

We already have in the todo list the possibility to have two separate sizes of thumbnails for listings and product page.

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

  • Posts: 26
  • Thank you received: 1
13 years 7 months ago #14777

Hope this gest done soon. Really need it :)

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

Time to create page: 0.057 seconds
Powered by Kunena Forum