Jump to content

Please help :)


think-digitally

Recommended Posts

Hi Everyone.

 

The gallery was using a single file for the thumbnail as well as the full size. I realised that this was not going to work due to the bandwidth issues.

 

I have had help and managed to get the uploading process working, when you upload a photo it sends the full size image to on folder, and creates a smaller file for a thumbnail image in another folder.

 

I need help to edit the gallery page so that it uses the smaller file for the thumbnails.

 

It is the image_link for each that holds the information. I need some help to have some code to ensure the thumbnail directory is used rather than the full size directory.

 

Here is the layout of the mySQL database:

The database consists of:

image_catergory

Catergory

image_link

 

image_gallery

image_id

folder_name

image_name

img_time

image_link

filename

sub_folder

 

sub_cat

sub_cat

imagelink

parent_cat

 

Here is the gallery code.

<?php 
require_once 'header2.php';
$time_stamp = date("d.m.Y");
$date = $time_stamp;
?>
<tr><td><table align="center">
<?php
/////////////////////////////////////////////////////////////
if(isset($_GET['image_cat']))
{
$cater = $_GET['image_cat'];
$_SESSION['image_cat'] = $cater;
$query = "SELECT sub_cat FROM `sub_cat` WHERE `parent_cat` = '{$cater}'";
$result = mysql_query($query) or die("Error:" . mysql_error());
$i = 0;
?>
<tr><td><div id="image_gal"><a href="image_gallery.php">Galleries</a> > <?php echo $cater;?></div></td></tr>
<tr><td><table width="0" align="center">
  <tr><td><tr>
<?php
while ($row = mysql_fetch_assoc($result))  {
     if ($i == 3) {
          $i = 0; // reset variable
           echo "<tr>"; // break the line
     }
$car = $row['sub_cat'];	  
$sql = "SELECT * FROM image_gallery WHERE `sub_folder`='{$car}' ORDER BY RAND() LIMIT 1";
$reslt = mysql_query($sql) or die ("Error:" . mysql_error());
$rw = mysql_fetch_assoc($reslt);

	?><td class="style8"><b><?php echo $row['sub_cat']; ?></b></font><br><a href="?image_subcat=<?php echo $row['sub_cat']; ?>"><img width="165px" src="<?php echo $rw['image_link']; ?>"></a></td><td>    </td>
	<?php

     $i++; // increase $i each time through the loop
}
?>
</td></tr><tr><td> </td></tr></table></td></tr>
<?php
if (mysql_num_rows($result) < 1) 
{
echo "<tr><td>No Images Yet.</td></tr><tr><td>Keep Checking Back</td></tr>";
}
require_once 'footer.php';
exit();
}
/////////////////////////////////////////////////////////////
if(isset($_GET['image_subcat'])) // If the URL ends in ?image_cat do everything in the brakets
{
$sub_cat = $_GET['image_subcat'];
$query = "SELECT folder_name,image_link,image_id,image_name,sub_folder FROM `image_gallery` WHERE `sub_folder` = '{$sub_cat}' ORDER BY image_id ASC";
$result = mysql_query($query) or die("Error:" . mysql_error());
$i = 0;
?>
<tr><td><div id="image_gal"><a href="image_gallery.php">Galleries</a> > <a href="?image_cat=<?php echo $_SESSION['image_cat'];?>"><?php echo $_SESSION['image_cat'];?></a> > <?php echo $sub_cat;?></div></td></tr>
<tr><td><table align="center"><tr>
<?php
while ($row = mysql_fetch_assoc($result))  {
     if ($i == 3) {
          $i = 0; // reset variable
          echo "</tr><tr><td> </td></tr><tr>"; // break the line
     }

?><td><a href="<?php echo $row['image_link']; ?>" rel="lightbox [main]" title="<?php echo $row['image_name']; ?>" ><img width="165px" src="<?php echo $row['image_link']; ?>"></a><br><?php echo $row['image_name']; ?></td>
<?php

     $i++; // increase $i each time through the loop
}
?>
</td></tr><tr><td> </td></tr></table></td></tr>
<?php
require_once 'footer.php';
exit();
}
/////////////////////////////////////////////////////////////
//No ID passed to page, display user list:
?>
<table width="100%" bgcolor="#e5e5e5" id="1">
<tr>
  <td width="2%"> </td>
<td width="98%" height="30" class="style4"><div align="left">Galleries</div>
    </font></td>
</tr>
<tr>
  <td> </td>
  <td class="style6"><div align="left">Please choose a gallery below, and use the in-gallery navagation to take a look around.</div>
    </font></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td> </td>
  </tr>
</table>
<?php
$query = "SELECT catergory,image_link FROM `image_catergory` ORDER BY catergory ASC";
$result = mysql_query($query) or die("Error:" . mysql_error());
$i = 0;
?>
<tr><td><table align="center">
<tr>
<?php
while ($row = mysql_fetch_assoc($result))  {
     if ($i == 3) {
          $i = 0; // reset variable
           echo "</tr><tr>"; // break the line
     }
$car = $row['catergory'];	  
$sql = "SELECT * FROM image_gallery WHERE `folder_name`='{$car}' ORDER BY RAND() LIMIT 1";
$reslt = mysql_query($sql) or die ("Error:" . mysql_error());
$rw = mysql_fetch_assoc($reslt);

	?><td><a href="?image_cat=<?php echo $row['catergory']; ?>" class="style4>"<b><?php echo $row['catergory']; ?></b></font><br><img width="170px" src="<?php echo $rw['image_link']; ?>"></a></td><td>    </td>
	<?php

     $i++; // increase $i each time through the loop
}
?>
</td></tr><tr><td> </td></tr><table>
<?php
if (mysql_num_rows($result) < 1) 
{
echo "<tr><ts>No Images Yet.</td></tr><tr><td>Keep Checking Back</td></tr>";
}
if($_SESSION['log_in'] == true)
{
?>
<?php
} 
require_once 'footer.php';
?>

 

Thankyou very much to anyone that helps.

 

 

Link to comment
https://forums.phpfreaks.com/topic/109605-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.