Log in

View Full Version : Resolved Implementing "Image Thumbnail Viewer II" using php



itskimical
11-05-2010, 09:45 PM
I have been trying to implement the "Image Thumbnail Viewer II" (http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm) with a php file and have had some issues.

The HTML code is this

<a href="LARGE IMAGE # 1" rel="enlargeimage" rev="targetdiv:loadarea" title="Image # 1 Title">SMALL IMAGE # 1</a><br />
<a href="LARGE IMAGE # 2" rel="enlargeimage" rev="targetdiv:loadarea" title="Image # 2 Title">SMALL IMAGE # 1</a><br />

etc.....

<div id="loadarea" style="width: 600px"></div>

I have two images
Large Image - $display_lgimage1
Thumbnail - $display_smimage1

When I enter in this code::

echo "<div id=\"loadarea\" style=\"width:600px\"></div>";

if (!empty($display_lgimage1))
echo "<a href=\"$display_lgimage1\"";
echo "rel=\"enlargeimage::mouseover\" rev=\"targetdiv:loadarea\">";
echo "$display_smimage1</a>";

if (!empty($display_lgimage2))
echo "<a href=\"$display_lgimage2\"";
echo "rel=\"enlargeimage::mouseover\" rev=\"targetdiv:loadarea\">";
echo "$display_smimage2</a>";
This happens::
http://www.prettysmartcart.com/smartcart/images/storeimages/error.png
See - no load area.

Have hard linked the script - so that shouldn't be the issue.

Nile
11-05-2010, 09:52 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

Also, go to View->Page source on your browser and scroll down to your issue and see ow PHP is rendering what you put in.

Good luck

Nile
11-05-2010, 10:10 PM
Look at the source of the page:


<a href="<img border="0" src="http://prettysmartcart.com/smartcart/images/Coat-2.png" class="largeimage1" alt="Beige Trench Coat-Over Coat, Trench Coat">"rel="enlargeimage::mouseover" rev="targetdiv:loadarea">

It looks like your display_lgimages are the HTML to insert an <img> and not just the source. Can you provide ALL your php?

itskimical
11-05-2010, 10:22 PM
<?php
if (file_exists("openinfo.php") OR isset($_REQUEST['dblink']) OR empty($dblink))
die("Cannot open file.");

// Display one item
$searchrow = mysql_fetch_array($searchresult);
include (SB_INC_DIR ."/products_variables.php");

if (!empty($display_formflds))
echo "<form method=\"post\" action=\"$URL/" .SB_GO_DIR ."/order.php\">";

echo "<a name=\"$searchrow[0]\"></a>";
echo "<div align=\"center\">";

// DISPLAY FORM FIELDS
if (!empty($display_formflds))
echo $display_formflds;

echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\">";

// LARGE IMAGES
echo "<div id=\"loadarea\" style=\"width:600px\"></div>";

if (!empty($display_lgimage1))
echo "<a href=\"$display_lgimage1\"";
echo "rel=\"enlargeimage::mouseover\" rev=\"targetdiv:loadarea\">";
echo "$display_smimage1</a>";

if (!empty($display_lgimage2))
echo "<a href=\"$display_lgimage2\"";
echo "rel=\"enlargeimage::mouseover\" rev=\"targetdiv:loadarea\">";
echo "$display_smimage2</a>";

// PRODUCT NAME
if (!empty($display_item))
echo "<tr><td align=\"center\" colspan=\"2\" class=\"boldtext\">$display_item</td></tr>";

// DESCRIPTION
if (!empty($display_description))
echo "<tr><td align=\"left\" colspan=\"2\">$display_description</td></tr>";

// SHOW POP UP
if (!empty($display_popup))
echo "<tr><td align=\"left\" colspan=\"2\">$display_popup</td></tr>";

// LIMITED ITEMS MESSAGE
if (!empty($display_limited))
echo "<tr><td align=\"center\" colspan=\"2\" class=\"accent\">$display_limited</td></tr>";

// INVENTORY CHECK
if (!empty($display_inventory))
echo "<tr><td align=\"center\" colspan=\"2\" class=\"salecolor\">$display_inventory</td></tr>";

// DISCOUNT PRICES
if (!empty($display_discounts))
echo "<tr><td valign=\"top\" align=\"left\" colspan=\"3\">$display_discounts</td></tr>";

// ITEM PRICE
if (!empty($display_price))
echo "<tr><td valign=\"top\" align=\"right\" class=\"accent\">$label_price</td><td valign=\"top\" align=\"left\">$display_price</td></tr>";

// OUT OF STOCK
if (!empty($display_outofstock))
echo "<tr><td valign=\"top\" align=\"center\" colspan=\"2\" class=\"accent\">$display_outofstock</td></tr>";

// DISPLAY OPTIONS
if ($optnum > 0)
{
for ($optcount = 1; $optrow = mysql_fetch_array($optresult); ++$optcount)
{
if ($optrow[Active] == "Yes")
{
$optionname = stripslashes($optrow[3]);
$attributes = stripslashes($optrow[5]);
$attributes = str_replace("\"", "&quot;", $attributes);
$product_id = $searchrow[0];
echo "<tr><td valign=\"top\" align=\"right\" class=\"accent\">" .optionnames($optionname) .":</td>";
echo "<td valign=\"top\" align=\"left\">";
echo "<input type=\"hidden\" name=\"opttype$optcount\" value=\"$optrow[4]\" />";
echo "<input type=\"hidden\" name=\"optname$optcount\" value=\"$optionname\" />";
include (SB_INC_DIR ."/products_options.php");
echo "</td></tr>";
}
}
}

// WHOLESALE DISCOUNTS
if (!empty($display_wholesale))
echo "<tr><td valign=\"top\" align=\"right\" class=\"accent\">$label_wholesale</td><td valign=\"top\" align=\"left\">$display_wholesale</td></tr>";

// MEMBER DISCOUNTS
if (!empty($display_coupon))
echo "<tr><td valign=\"top\" align=\"right\" class=\"accent\">$label_coupon</td><td valign=\"top\" align=\"left\">$display_coupon</td></tr>";

// START ORDER DETAILS W/ BUTTON
if (!empty($display_orderbutton))
echo "<tr><td valign=\"top\" align=\"right\" class=\"accent\">$label_qty</td><td valign=\"top\" align=\"left\">$display_showqty &nbsp; $display_orderbutton $display_registrybutton</td></tr>";
else if (!empty($display_registrybutton))
echo "<tr><td valign=\"top\" colspan=\"2\">$display_registrybutton</td></tr>";

echo "</table>";
echo "</div>";
if (!empty($display_formflds))
echo "</form>";

// EMAIL FRIEND LINK
if (!empty($display_emaillink))
echo "<p align=\"center\">$display_emaillink</p>";

// RELATED ITEMS
if ($relnum > 0)
{
echo "<p class=\"accent\" align=\"center\">$relatedmsg</p>";
include (SB_INC_DIR ."/products_related.php");
}

// RETURN TO CATALOG LINK
if (!empty($display_return))
echo "<p align=\"center\">$display_return</p>";
?>

Nile
11-05-2010, 10:28 PM
Where are you getting the display_lgimage variables from then..?

itskimical
11-05-2010, 10:33 PM
because the original code was this

// LARGE IMAGES
if (!empty($display_lgimage1))
echo "<tr><td align=\"center\" colspan=\"2\">$display_lgimage1</td></tr>";
if (!empty($display_lgimage2))
echo "<tr><td align=\"center\" colspan=\"2\">$display_lgimage2</td></tr>";
if (!empty($display_lgimage3))
echo "<tr><td align=\"center\" colspan=\"2\">$display_lgimage3</td></tr>";

which works fine

Nile
11-05-2010, 10:34 PM
Okay - but now, where are you getting the variables from? Please include the source to that file also.

itskimical
11-05-2010, 11:05 PM
I guess that comes up because in another file it states

// LARGE DETAIL IMAGE 1
if ($searchrow[LgImage])
$imgname1 = $searchrow[LgImage];
else
$imgname1 = "";
if (!empty($imgname1))
{
if (substr($imgname1, 0, 7) != "http://")
$imgname1 = "$URL/$imgname1";
$display_lgimage1 .= "<img border=\"0\" src=\"$imgname1\" class=\"largeimage1\" alt=\"$stripalt\">";
}

// LARGE DETAIL IMAGE 2
if ($searchrow[LgImage2])
$imgname2 = $searchrow[LgImage2];
else
$imgname2 = "";
if (!empty($imgname2))
{
if (substr($imgname2, 0, 7) != "http://")
$imgname2 = "$URL/$imgname2";
$display_lgimage2 .= "<img border=\"0\" src=\"$imgname2\" class=\"largeimage2\" alt=\"$stripalt\">";
}

// LARGE DETAIL IMAGE 3
if ($searchrow[LgImage3])
$imgname3 = $searchrow[LgImage3];
else
$imgname3 = "";
if (!empty($imgname3))
{
if (substr($imgname3, 0, 7) != "http://")
$imgname3 = "$URL/$imgname3";
$display_lgimage3 .= "<img border=\"0\" src=\"$imgname3\" class=\"largeimage3\" alt=\"$stripalt\">";
}

Could I clear out....class=\"largeimage3\" alt=\"$stripalt\"?

Nile
11-06-2010, 11:53 PM
Find:


$display_lgimage1 .= "<img border=\"0\" src=\"$imgname1\" class=\"largeimage1\" alt=\"$stripalt\">";

And get rid of everything but the highlighted. Do the same for all 3.

GlennR
09-23-2011, 06:19 PM
Were you able to get it to work? I use that image viewer with that particulr shopping cart and it seems to work fine ....