Thumbnail linking to large image problem.

That was the problem, I hadnt deleted all the images from the folders, just the tables. It works fine now that I have deleted from folders and tables.

I have 2 more thing I would like to do to make this a proper upload and display system, but I will start a new thread as the question in the ‘subject’ text box has been solved. I dont want to clutter up this thread with other questions.

I cant thank you enough for your help!..

Actually, there are a couple more things. I want to display the text for each image(from the name column of image_thumbs) under each thumbnail in the galley.

This is the code i have for this, but it is not displaying any text.

[php]

Gallery body{ background-color:yellow; } #thumbs{ width: 1300px; position: relative; top: 40px; left: 0px; }

#here{
position: relative;
left:100px;
background-color:white;
}
div.thumb{

float: left;
padding: 10px 5px 10px 5px;
margin-bottom: 60px;

}
img.thumbnail{
border-style: solid;
border-width: 2px;
border-color: red;
background-color: black;
padding: 15px;
}

<?php include 'connect.php';

?>

Here are all the images in the gallery:

<?php $q = "SELECT a.imagepath AS thumbpath, b.imagepath AS imagepath FROM image_thumbs AS a JOIN table_images AS b USING(id)"; $t = "SELECT name FROM image_thumbs"; $row2 = mysql_query($t);

if($r = mysql_query($q))
{
echo ‘

’;
while($row=mysql_fetch_array($r))
{
echo ‘
’,
“<a href=’{$row[‘imagepath’]}’><img class=‘thumbnail’ src=’{$row[‘thumbpath’]}’ alt=‘Image’ />”,

”,
“{$row2[‘name’]}”,
’;
}
  echo '</div>';

}
else
{
echo mysql_error();
}

?>

[/php]

And I also need the images to display so that they are in reverse order, the tables add the data to the end but I want the gallery to display the images so that the last one uploaded is the first one in the gallery. How would I go about doing this?

Figured out the image display thing.

I added
[php]ORDER BY id DESC[/php]
to the end of my query.

So now I have

[php]$q = “SELECT a.imagepath AS thumbpath, b.imagepath AS imagepath
FROM image_thumbs AS a
JOIN table_images AS b
USING(id) ORDER BY id DESC”;[/php]

Really glad you are close to having it how you want.

In order to get the names to display you will first need to change your query to this:[php]$q = “SELECT a.imagepath AS thumbpath, b.imagepath AS imagepath, name
FROM image_thumbs AS a
JOIN table_images AS b
USING(id) ORDER BY id DESC”;[/php]

I would do something like this:[php]echo "


<a href=’{$row[‘imagepath’]}’>
<img class=‘thumbnail’ src=’{$row[‘thumbpath’]}’ alt=‘Image’ />
{$row[‘name’]}
";[/php]

And add classes for imgLabel:.imgLabel{ text-align: center; }

Note that you would likely want to go back and tweak some of the elements to your thumbs class, as adding the name might throw things off.

Thhank you ever so much!

The upload and display(of thumbs) are just how I want so I will mark this solved.
As I said I have 2 more issues regarding this upload system, but I will start another thread. Want to make this searchable by subject so hopefully this can help someone else in the future.

Again, big big thanks. Karma +

Glen…

My pleasure Glen,

Glad we got it working. Feel free to let me know if you have any other questions!

Best,

jay

Sponsor our Newsletter | Privacy Policy | Terms of Service