You are here:  » File extension to merchant logo


File extension to merchant logo

Submitted by wesse249 on Tue, 2015-12-22 08:02 in

Hello David,

Is it possible that merchant logo's get a file extension like .png?

I want this because browsercaching isn't cache these logo because they have no extension.

I got google insights almost at 100% but this is the last problem i have to solve.

Maybe this is also usefull for other users. I added this to my .htaccess and it increased the speed very much:

<IfModule mod_deflate.c>
    <filesMatch "\.(js|css|html|php)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</IfModule>
<IfModule mod_expires.c>
<Filesmatch "\.(jpg|jpeg|png|gif|css|ico|woff)$">
Header set Cache-Control "public, max-age=604800, s-maxage=604800, must-revalidate, proxy-revalidate"
ExpiresActive On
ExpiresDefault "access plus 1 week"
</Filesmatch>
<Filesmatch "\.(javascript|js)$">
Header set Cache-Control "public, max-age=31536000, s-maxage=31536000, must-revalidate, proxy-revalidate"
ExpiresActive On
ExpiresDefault "access plus 1 year"
</Filesmatch>
</IfModule>

Thanks Jan Roel

Submitted by support on Tue, 2015-12-22 11:26

Hello Jan,

Note for 15/09A distribution:
Merchant logo filename extension is now configurable in config.advanced.php at line 96:

  $config_logoExtension = ".img";

For 15/01A:

First edit merchants.php and look for the following code at line 16:

      if (file_exists("logos/".$product["merchant"]))
      {
        $item["logo"] = $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"]);
      }

...and REPLACE with:

      if (file_exists("logos/".$product["merchant"].".png"))
      {
        $item["logo"] = $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"].".png");
      }

Then in html/prices.php look for the following code at line 47:

            <?php if (file_exists("logos/".$product["merchant"])): ?>
              <td class='pt_pr_mlogo'><a href='<?php print tapestry_buyURL($product); ?>'><img alt='<?php print htmlspecialchars($product["merchant"],ENT_QUOTES,$config_charset); ?> <?php print translate("Logo"); ?>' src='<?php print $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"]); ?>' /></a></td>
            <?php else: ?>

...and REPLACE with:

            <?php if (file_exists("logos/".$product["merchant"].".png")): ?>
              <td class='pt_pr_mlogo'><a href='<?php print tapestry_buyURL($product); ?>'><img alt='<?php print htmlspecialchars($product["merchant"],ENT_QUOTES,$config_charset); ?> <?php print translate("Logo"); ?>' src='<?php print $config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"].".png"); ?>' /></a></td>
            <?php else: ?>

Then in admin/merchant_logos.php look for the following code at line 14:

if (move_uploaded_file($_FILES['image']['tmp_name'],"../logos/".$_POST["merchant"]))

...and REPLACE with:

if (move_uploaded_file($_FILES['image']['tmp_name'],"../logos/".$_POST["merchant"].".png"))

Then the following code at line 41:

$logoFilename = "../logos/".$row["merchant"];

...REPLACE with:

$logoFilename = "../logos/".$row["merchant"].".png";

And finally the following code at line 56:

        print "<td><img style='padding:10px;' src='".$config_baseHREF."logos/".str_replace(" ","%20",$row["merchant"])."' alt='".htmlspecialchars($row["merchant"],ENT_QUOTES,$config_charset)." Logo' /></td>";

...REPLACE with:

        print "<td><img style='padding:10px;' src='".$config_baseHREF."logos/".str_replace(" ","%20",$row["merchant"].".png")."' alt='".htmlspecialchars($row["merchant"],ENT_QUOTES,$config_charset)." Logo' /></td>";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com