Results 1 to 10 of 10

Thread: Implementing "Image Thumbnail Viewer II" using php

  1. #1
    Join Date
    Oct 2010
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Unhappy Implementing "Image Thumbnail Viewer II" using php

    I have been trying to implement the "Image Thumbnail Viewer II" with a php file and have had some issues.

    The HTML code is this
    Code:
    <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::
    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::

    See - no load area.

    Have hard linked the script - so that shouldn't be the issue.
    Last edited by itskimical; 11-09-2010 at 04:10 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    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
    Jeremy | jfein.net

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Look at the source of the page:
    Code:
    <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?
    Jeremy | jfein.net

  4. #4
    Join Date
    Oct 2010
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    PHP Code:
    <?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>";
    ?>

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Where are you getting the display_lgimage variables from then..?
    Jeremy | jfein.net

  6. #6
    Join Date
    Oct 2010
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    because the original code was this
    PHP Code:
    // 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

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Okay - but now, where are you getting the variables from? Please include the source to that file also.
    Jeremy | jfein.net

  8. #8
    Join Date
    Oct 2010
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I guess that comes up because in another file it states
    PHP Code:
    // LARGE DETAIL IMAGE 1
    if ($searchrow[LgImage])
    $imgname1 $searchrow[LgImage];
    else
    $imgname1 "";
    if (!empty(
    $imgname1))
    {
    if (
    substr($imgname107) != "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($imgname207) != "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($imgname307) != "http://")
    $imgname3 "$URL/$imgname3";
    $display_lgimage3 .= "<img border=\"0\" src=\"$imgname3\" class=\"largeimage3\" alt=\"$stripalt\">";

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

  9. #9
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Find:
    Code:
    $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.
    Jeremy | jfein.net

  10. The Following User Says Thank You to Nile For This Useful Post:

    itskimical (11-09-2010)

  11. #10
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Were you able to get it to work? I use that image viewer with that particulr shopping cart and it seems to work fine ....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •