Colocation Site Admin

Joined: Jan 07, 2004 Posts: 412
|
Posted: Tue Sep 28, 2004 10:13 am Post subject: Image Restriction |
|
|
See this block, how can we restrict the size of the image shown? To say 100 pixels?
| Code: |
if (eregi("block-Amazon.php",$PHP_SELF))
{
Header("Location: index.php");
die();
}
global $temp, $prefix, $db, $currentlang, $lang, $language, $newlang;
# Get Settings
$sql = "SELECT AMZVer, AMZModule_Name, AMZ_id, cache_maxtime, AMZMore, AMZSingle, AMZQuickAdd, AMZShowReview, AMZShowSimilar, AMZLocale, AMZReviewMod, ImageType, AMZ_Popular, AMZBuyBox, AMZShowXML FROM ".$prefix."_amazon_cfg";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$AMZVer = $row[AMZVer];
$AMZModule_Name = $row[AMZModule_Name];
$amazon_id = $row[AMZ_id];
$amazon_xml_cache_maxtime = $row[cache_maxtime];
$AMZMore = $row[AMZMore];
$AMZSingle = $row[AMZSingle];
$AMZQuickAdd = $row[AMZQuickAdd];
$AMZShowReview = $row[AMZShowReview];
$AMZShowSimilar = $row[AMZShowSimilar];
$AMZLocale = $row[AMZLocale];
$AMZReviewMod = $row[AMZReviewMod];
$AMZImgType = $row[ImageType];
$AMZ_Popular = $row[AMZ_Popular];
$AMZBuyBox = $row[AMZBuyBox];
$AMZShowXML = $row[AMZShowXML];
require_once("includes/NukeAmazon/functions.php");
if (isset($newlang))
{
include("modules/Amazon/language/lang-$newlang.php");
$language = $newlang;
}
elseif (isset($lang))
{
include("modules/Amazon/language/lang-$lang.php");
$language = $lang;
}
else
{
include("modules/Amazon/language/lang-$language.php");
}
$Asin = GetAsin('');
$amazon = amazon_search('AsinSearch', $Asin, '', 'lite', '');
if(isset($amazon->errorMsg))
{
# Error with Requested Data, use the default ASIN.
$SQL = "SELECT default_asin FROM ".$prefix."_amazon_cfg";
$result = sql_query($SQL, $dbi);
list($Asin) = sql_fetch_row($result, $dbi);
$amazon = amazon_search('AsinSearch', $Asin, '', 'lite', '');
}
sql_query("update ".$prefix."_amazon_items set imp=imp+1 where asin='$Asin'", $dbi);
foreach ($amazon->records as $ind => $arr) {
# Extract fields of interest but first clear from previews pass.
$ProductCatalog = $arr['catalog'];
if( is_array($arr['artist']))
{
$ArtistCount = count($arr['artist']);
$Artist = "";
$i = 0;
while ($ArtistCount > $i)
{
if ($i > 0)
{
$Artist .= ", ";
}
$Artist .= "<a href=\"modules.php?name=$AMZModule_Name&op=ArtistSearch&keyword=".urlencode($arr['artist'][$i])."&mode=".strtolower($ProductCatalog)."\">".$arr['artist'][$i]."</a>";
$i++;
}
}
$ProductName = $arr['productname'];
$OurPrice = $arr['ourprice'];
if ($OurPrice == "")
{
$OurPrice = $arr['listprice'];
}
$ListPrice = $arr['listprice'];
$Savings = AMZsavings($ListPrice,$OurPrice);
if (strtolower($OurPrice) == "too low to display")
{
$OurPrice = ""._AMZTOOLOW."";
}
}
$ImageUrl = AMZIS($Asin, 'M');
if ($Savings[1] > 0 && $AMZImgType != "NO")
{
if ($Savings[1] > 9)
{
$ImageUrl = str_replace (".01.", ".01._PE".$Savings[1]."_".$AMZImgType."_SC", $ImageUrl);
}
else
{
$ImageUrl = str_replace (".01.", ".01._PE0".$Savings[1]."_".$AMZImgType."_SC", $ImageUrl);
}
$ImageUrl = str_replace (".jpg", "_.jpg", $ImageUrl);
}
$LinkURL = "modules.php?name=$AMZModule_Name&asin=$Asin";
$LinkStartStr = "<a href=\"$LinkURL\">";
$content = "<table width=\"129\"><tr width=\"129\"><td width=\"129\"><br><center>\n";
if ($Artist)
{
$content .= "<b>" . $Artist . "</b><br><br>\n";
}
$content .= $LinkStartStr;
$content .= "<img src=\"" . $ImageUrl . "\" border =\"0\" alt=\"$ProductName\">\n";
$content .= "</a></center>";
$content .= "</td>\n";
$content .= "<tr width=\"129\">";
$content .= "<td width=\"129\"><center>\n";
$content .= $LinkStartStr;
$content .= "<b>$ProductName</b>";
$content .= "</a>";
$content .= "<br>";
if ($OurPrice)
{
$content .= "<b>"._AMZBLKPRICE.":</b> $OurPrice</b><br>\n";
}
if ($AMZBuyBox)
{
$content .= AMZBuyBox($Asin);
}
$content .= "</center></td>";
$content .= "</tr>";
$content .= "</table>"; |
|
|