Jump to content

[SOLVED] More Photo Gallery Problems


camdes

Recommended Posts

After much research and hair pulling I have managed to get my photos uploaded, resized and have created thumbnails which are stored in a separate directory. All the required information about the uploaded files including the paths are stored in a Mysql database.

 

My problem now is that when I retrieve all the thumbnails in a category I can only display them in a single column. I would like to display them in 4 or 6 columns with as many rows as required, can someone help a newbie please.

Link to comment
Share on other sites

Worked at it another way but still having problems. The following code is not the one I will be finally using but I am trying to do one step at a time.

 

The table I am showing should have a thumbnail in one column and a link path in another. This is just to show that the SELECT statement is working. The first column does not show the thumbnails and does not even pick up the path while the second column does and the links work. Can anyone help, I seem to have been at this for ever.

 

<?php
$SQL = 'SELECT photo_id, photo_thumbnail FROM gallery_photos ';

// execute SQL statement 
$ret = mysql_db_query($dbname,$SQL,$link); 
$numrows = mysql_num_rows($ret);

if (!$ret) { echo( mysql_error()); } 
else { 
while ($img = mysql_fetch_array($ret)) { 
$id = $img[photo_id];
$thumbnail = $img[photo_thumbnail];
$i = $numrows;

echo ("<TR>");
echo ('<td> <img src=<?php echo ("$thumbnail");?>> </td>');
echo ("<TD><a href=\"$thumbnail\" target=_blank>$thumbnail</a></TD>\n"); 

echo ("</TR>"); 
}
echo ("</TABLE>");
}

?>  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.