You are here:  » Scale category images


Scale category images

Submitted by wesse249 on Sun, 2016-02-07 21:04 in

Hello David,

Is there a solution to scale images on the searchresult/category pages? I have now some strange sizes.

For example scroll to the bottom of this page:{link saved}

And then this product: Cocco Laptoptas Groen

Thank you,

Jan Roel

Submitted by support on Mon, 2016-02-08 10:16

Hello Jan,

The issue here is using a fixed height for images that are much wider than they are tall. Since you are using a grid layout, I think the best thing to do would be to put the image inside a containing <div> that has the fixed height, and then Foundation will scale the image to fit that container without distortion.

To do this, edit html/searchresults.php (I know that yours is based on the Featured Products HTML module) and look for where the image is displayed using:

<a href='<?php print $product["productHREF"]; ?>'><img alt='<?php print translate("Image of"); ?> <?php print htmlspecialchars($product["name"],ENT_QUOTES,$config_charset); ?>' class='pt_fp_image' src='<?php print htmlspecialchars($product["image_url"],ENT_QUOTES,$config_charset); ?>' /></a>

...and REPLACE with:

<div class='pt_fp_image' >
<a href='<?php print $product["productHREF"]; ?>'><img alt='<?php print translate("Image of"); ?> <?php print htmlspecialchars($product["name"],ENT_QUOTES,$config_charset); ?>' src='<?php print htmlspecialchars($product["image_url"],ENT_QUOTES,$config_charset); ?>' /></a>
</div>

And then in html/default.php look for the existing .pt_fp_image class definition:

  .pt_fp_image {
    border: 0;
    height:100px;
    max-width:none;
  }

...and REPLACE with:

  .pt_fp_image {
    height:100px;
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com