Results 1 to 5 of 5

Thread: Need help modifying code on Image Thumbnail Viewer II

  1. #1
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need help modifying code on Image Thumbnail Viewer II

    1) Script Title: Image Thumbnail Viewer II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    3) Describe problem:
    Hi all, i'm doing a project at uni and needed a script like this. i've got this script working to its perfect working parameters, however i was wandering if someone could help me modify the code so that the first image is showing in the load area div when the page loads. This would be very helpful as i do not know the first thing about java script. I literally copied, pasted and prayed.

    I'm using a php database to dynamically create multiple thumbnail viewers. Works a treat! however, none of the large images work. In the good spirit of programming, if you are intrested, i copied the code below. Im new to php programming (first week) so i'm sure theres a better way of doing it, but this works.

    Any help is most welcomed.

    Many Thanks, Paul.

    PHP Code:
    <?php
    //if you are at city university in london, in your final year doing a php project, dont copy this code. you dont want to get done for plagurism because i know i wont!

    //This will make one table with 4 columns per row and will make an infinate number of rows depending on the datasource.
    // my connection string.
    include("connection.php");
    //there are four images stored on the site, all with the same start of name, which is storred in the table in the "name field"
    $result mysql_query("SELECT * FROM cards");
    //count is used to assign seperate divs to each set.
    $count 1;
    $column 1;
    echo 
    "<table class = 'table'><tr><td>";
    while(
    $row mysql_fetch_array($result))
    {
    //loads a new div
        
    echo"<div id='loadarea".$count."' class = 'thumb'></div><br>";
    //loads the 4 images.    
        
    echo"<a href='CardTemplates/".$row['name']."front_thumb.jpg' rel='enlargeimage::mouseover' rev='loadarea".$count."::CardTemplates/".$row['name']."front.jpg' title='front'><img class='thumbRollover' src='CardTemplates/".$row['name']."front_thumb.jpg' /></a>";
        
        echo
    "<a href='CardTemplates/".$row['name']."left_thumb.jpg' rel='enlargeimage::mouseover' rev='loadarea".$count."::CardTemplates/".$row['name']."left.jpg' title='left'><img class='thumbRollover' src='CardTemplates/".$row['name']."left_thumb.jpg' /></a>";

        echo
    "<a href='CardTemplates/".$row['name']."right_thumb.jpg' rel='enlargeimage::mouseover' rev='loadarea".$count."::CardTemplates/".$row['name']."right.jpg' title='right'><img class='thumbRollover' src='CardTemplates/".$row['name']."right_thumb.jpg' /></a>";

        echo
    "<a href='CardTemplates/".$row['name']."back_thumb.jpg' rel='enlargeimage::mouseover' rev='loadarea".$count."::CardTemplates/".$row['name']."back.jpg' title='back'><img class='thumbRollover' src='CardTemplates/".$row['name']."back_thumb.jpg' /></a>";
        
    // if the column gets to 4 then it makes a new row in the table. Change that number to fit more/less on each row.
        
    if ($column >= 4)
        {
            echo 
    "</td></tr><tr><td>";
            
    $column 1;
        }
        else
        {
            echo 
    "</td><td>";
            
    $column ++;
        }
        
    $count ++;
        
    }
    echo 
    "</td></tr></table>";
    mysql_close($con);
    ?>

  2. #2
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Paul,

    I have the same problem aswell! I also would like to know how to show the first picture when the page loads.

    Whats your url?

  3. #3
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi Steelo, i've not hosted the site yet, its still on my local machine. I'll be hosting it by monday if i manage to get it to work on my university space.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This has been addressed many times before. Since the contents of the loadarea will be overwritten by the script once one of the triggers is activated, you may place any HTML in there that you like, ex:

    Code:
    <div id="loadarea" style="width: 600px">
    <img src="http://www.nasa.gov/images/content/167040main_image_feature_738_ys_4.jpg" alt="">
    </div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    neo8223 (02-12-2009)

  6. #5
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you sooo much! i have the table exactly how i would like it now.

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
  •