Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Image Swap/1 large image 4 Thumbnails
Old 09-24-2008, 02:02 PM Image Swap/1 large image 4 Thumbnails
Junior Talker

Posts: 1
Trades: 0
Dear All,
What i need to do is add four thumbnails, which I can do using the code I have. But now I need to create a way in which I can swap the large image for the thumbnail images once there clicked. I have tried lots of ways and just can't get it working. Can some one help me insert the code i need.

One way I have tried is below.

Code:
 
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile1.jpg"><imgsrc="smallthumb1.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile2.jpg"><imgsrc="smallthumb2.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile3.jpg"><imgsrc="smallthumb3.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile4.jpg"><imgsrc="smallthumb4.jpg"></a>
 
if(isset($_GET['image'])){
 
<img src="$_GET['image']">
 
}
 
else{
<img src="defaultimage.jpg">
}
 
echo "<img src='" . $_GET['image'] ."'>";
Here is the code which is pulling the correct images for the detials page of a property.

Code:
 
<?php
    require 'listing.inc';
 
    if (array_key_exists("propID", $_GET))
        $propertyID = $_GET["propID"];
    else
        die("Sorry, cannot locate the details for that property");
 
    $query = "SELECT Price, PropertyID, Area, MainDescription, Parking, cFacility1, cFacility2, cFacility3, cFacility4, ";
    $query = $query . "cFacility5, cFacility6, cFacility9, PropertyName FROM listings WHERE PropertyID = '{$propertyID}';";
 
        // Connect to the server
    if (!($connection = @ mysql_connect($hostName, $userName, $password)))
        die("Cannot connect to server {$hostName}");
 
    // print '<div class="debug">Opening database</div>' . "\n";
 
        // Select the database
    if (!(mysql_select_db($databaseName, $connection)))
        showDbError();
 
    // print '<div class="debug">Issuing query</div>' . "\n";
 
    if (!($result = @ mysql_query($query, $connection)))
        showDbError();
 
    if (!($record = @ mysql_fetch_array($result)))
        die("Sorry, cannot locate the details for that property");
 
 
 
    $imageFile  = "photos/pBRANCH_{$record["PropertyID"]}.jpg";
    $imageFile2 = "photos/aBRANCH_{$record["PropertyID"]}.jpg";
 
 
 
    print "  <tr>\n";
    print '        <td height="277" width="411">' . "\n";
    print '        <div align="center">' . "\n";
    print "            <img src=\"{$imageFile}\"";
    print ' border="0" height="225" width="340" alt="Property photo" />' . "\n";
    print "            <img src=\"{$imageFile2}\"";
    print ' border="0" height="60" width="80" alt="Property photo"   />' . "\n";
    print "            <img src=\"{$imageFile2}\"";
    print ' border="0" height="60" width="80" alt="" />' . "\n";
    print "            <img src=\"{$imageFile}\"";
    print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";
    print "            <img src=\"{$imageFile}\"";
    print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";
    print "        </div>    </td>\n";
    print '        <td valign="top" width="389"><p class="style5"><br>' . "\n";
    print '        <span class="style6"><span class="style8">Property</span><span class="style7"><br>Details</span></span>' . "\n";
    print '            <br><br><strong><br>Area:</strong>' . "\n";
    print "{$record["PropertyName"]}<br><strong>Price:</strong><span class=\"style24\"> &pound;{$record["Price"]} PCM</span>\n";
    print "        <br><br></p></td></tr>\n";
    print '  <tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" height="181" width="387">' . "\n";
    print "        <tr>\n";
    print '            <td bgcolor="#547cad" width="44">&nbsp;</td>' . "\n";
    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
    print "{$record["cFacility1"]}</span></td>\n";
    print '            <td bgcolor="#547cad" width="190"><span class="style17">• ';
    print "{$record["cFacility2"]}</span></td>\n";
    print "        </tr>\n";
    print "        <tr>\n";
    print '            <td bgcolor="#547cad" width="44">&nbsp;</td>' . "\n";
    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
    print "{$record["cFacility3"]}</span></td>\n";
    print '            <td bgcolor="#547cad" width="190"><span class="style17">• ';
    print "{$record["cFacility4"]}</span></td>\n";
    print "        </tr>\n";
    print "        <tr>\n";
    print '            <td bgcolor="#547cad" width="44">&nbsp;</td>' . "\n";
    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
    print "{$record["cFacility5"]}</span></td>\n";
    print '            <td bgcolor="#547cad" width="190"><span class="style17">• ';
    print "{$record["cFacility6"]}</span></td>\n";
    print "        </tr>\n";
    print "        <tr>\n";
    print '            <td bgcolor="#547cad" width="44">&nbsp;</td>' . "\n";
    print '            <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
    print "{$record["cFacility9"]}</span></td>\n";
    print '            <td bgcolor="#547cad" width="190"><span class="style17">• PARKING ';
    print "{$record["Parking"]}</span></td>\n";
    print "        </tr>\n";
    print "      </table></td>\n";
    print '        <td><p class="style5" align="justify"><strong>Main Description: </strong><br><br>' . "\n";
    print "{$record["MainDescription"]}\n";
    print '  </p><p class="style9">&nbsp;&nbsp;&nbsp;<a href="mailto:info@hslettings.com?subject=';
    print "{$record["PropertyName"]}";
    print '">REGISTER INTEREST </a></p></td>' . "\n";
    print "  </tr>\n";
?>
The main problem I had I think was linking to the dynamic images, $imageFile = "photos/pBRANCH_{$record["PropertyID"]}.jpg";

Any help would be greatfully recieved and if you could show me how to place the code into the page of code I would be over the moon. My coder/partner has had a heart attack and I am trying to do the best with the little knowledge I have.

CHOTCH is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Image Swap/1 large image 4 Thumbnails
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22936 seconds with 12 queries