Help handling image sizes for category thumbnails

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
9 years 11 months ago #216126

-- HikaShop version -- : 2.6.5
-- Joomla version -- : 3.4.3

I have this code extracted from a default view that loads an image for each catefory thumbnail

<div class="hikashop_category_image"> <!-- height:<?php echo $this->image->main_thumbnail_y; ?>px;text-align:center;clear:both; -->
      <a href="<?php echo $link; ?>" title="<?php echo $this->escape($this->row->category_name); ?>">
          <?php
          $image_options = array('default' => true, 'forcesize' => $this->config->get('image_force_size', true), 'scale' => $this->config->get('image_scale_mode', 'inside'));
          $img = $this->image->getThumbnail(@$this->row->file_path, array('width' => $this->image->main_thumbnail_x, 'height' => $this->image->main_thumbnail_y), $image_options);
          if ($img->success) {
              echo '<img class="hikashop_product_listing_image" title="' . $this->escape(@$this->row->file_description) . '" src="' . $img->url . '"/>';
          }
          ?>
      </a>
  </div>

I want to make my view load the images with the double the resolution it as actually creating the thumbs (because of a nice animation effect I created).

Or if calculation is not possible how can I force a loading at a predefined px width and height?

Thank you.

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

  • Posts: 84327
  • Thank you received: 13717
  • MODERATOR
9 years 11 months ago #216133

Hi,

It sure is possible.
Just change the line:

$img = $this->image->getThumbnail(@$this->row->file_path, array('width' => $this->image->main_thumbnail_x, 'height' => $this->image->main_thumbnail_y), $image_options);
There you have $this->image->main_thumbnail_x that you can replace by the value in px of the width you want, and $this->image->main_thumbnail_y that you can replace by the height.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum