Results 1 to 3 of 3

Thread: Lightbox and PHP image code

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Lightbox and PHP image code

    Hi there I wonder if some of you bright sparks can help me please?

    I have a simple shopping basket that doesn't provide a image preview tool its very basic as its free) and I wish to use lightbox as a preview; I'm not a coder but I wonder if someone could look at the code below and tell me how I can fix it so it works with lightbox?

    This is the php code that collects the product image:

    <?php
    if (is_file($SETTINGS["path"]."products/".$PRODUCT["image"])) echo "<img src='".$SETTINGS["URL"]."products/".$PRODUCT["image"]."' class='ProductImage' border='0'>";
    ?>

    This is the code for lightbox to work:

    rel="lightbox"

    I've had a go myself and managed to have the lightbox window open but no image shows, this is the code:

    <a href="#" border="0" rel="lightbox">
    <?php
    if (is_file($SETTINGS["path"]."products/".$PRODUCT["image"])) echo "<img src='".$SETTINGS["URL"]."products/".$PRODUCT["image"]."' class='ProductImage' border='0'>";
    ?></a>

    Of course I know the # should be the link for the image but I just can't get it to work.

    Please can someone help me here?

    Thanks

  2. #2
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Not to worry guys, I figured it out looking around the forum here:

    <a href="<?php echo ""."shop/products/".$PRODUCT["image"]?>" rel="lightbox" width="100%" border="0">
    <?php
    if (is_file($SETTINGS["path"]."products/".$PRODUCT["image"])) echo "<img src='".$SETTINGS["URL"]."products/".$PRODUCT["image"]."' class='ProductImage' border='0'>";
    ?></a>

    Now to figure out how to have the lightbox image larger I'm getting there with the help of this forum.

  3. #3
    Join Date
    Feb 2010
    Location
    Falkirk, Scotland
    Posts
    142
    Thanks
    21
    Thanked 4 Times in 4 Posts

    Default

    try:
    PHP Code:
    <?php
    if (is_file($SETTINGS["path"]."products/".$PRODUCT["image"])) echo "<img src='".$SETTINGS["URL"]."products/".$PRODUCT["image"]."' class='ProductImage' border='0' height='400' width='400'>";
    ?>

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
  •