You are here:  » Resize Images

Support Forum



Resize Images

Submitted by discountdriven on Fri, 2010-08-13 19:49 in

Hi David,

I have a merchant whose image size is very small... probably 1/4 of the size of most other merchant images. These are not their thumbnails, but their larger available image. When this merchant is the lowest priced merchant on a products page, the image looks terrible. Is there a way to either not use their photos and have the photo default to another merchant OR resize their photos?

I found this thread to resize: http://www.pricetapestry.com/node/656
However, I feel like I missed a previous part to the thread. I don't see what to do with the image file or where/how to create the file specifically.

Thanks,
Stacy

Submitted by support on Sat, 2010-08-14 08:02

Hi Stacy,

Sure - that would be easy to do in html/product.php. Look for the following code, near the top at line 3:

  <?php $mainProduct $product["products"][0]; ?>

...and REPLACE with;

  <?php $mainProduct $product["products"][0]; ?>
  <?php
    if ($mainProduct["merchant"]=="Merchant With Small Images")
    {
      $j = count($product["products"]);
      for($i=1;$i<$j;$i++)
      {
        if ($product["products"][$i]["image_url"])
        {
          $mainProduct["image_url"] = $product["products"][$i]["image_url"];
          break;
        }
      }
    }
  ?>

This will replace the Image URL with the next merchant in the list that has a valid image if the first one is "Merchant With Small Images"...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by discountdriven on Mon, 2010-08-16 15:31

Hi David,

I don't see

<?php
 $mainProduct 
$product["products"][0]; 
?>
anywhere.

This is my whole html/product.php page:

{code saved}

Submitted by support on Mon, 2010-08-16 15:35

Hi Stacy,

In your version, insert the modification after:

  <?php
  foreach($product["products"] as $i)
  {
    $mainProduct = $i;
    break;
  }
  ?>

Cheers,
David.
--
PriceTapestry.com

Submitted by discountdriven on Mon, 2010-08-16 16:18

Hi David,

I made the change, but the image has remained the same. Could this be because the top 5 merchants listed with the best price are all the same merchant?

Stacy

Submitted by support on Mon, 2010-08-16 16:35

Hi Stacy,

Top n shouldn't make any difference as long as there is another merchant with an image_url it will override, but if that is not the case it will not be overridden and the smaller image will be displayed - can you email me a link to an example page where the modification has not appeared to work, together with the associated products.php and html/products.php...

Cheers,
David.
--
PriceTapestry.com