PDA

View Full Version : Gallery Issue



Luno1599
31-01-2009, 07:16 PM
Hey,

I am making a script for photographers, and I am abit stuck with the images bit, I want to lay the thumbnail images out in a table 4 images wide by howeva many long/down...

But im stuck because when the user makes the gallery they specify a folder that the images are in names thumb_imagename.jpg and imagename.jpg but I dont know how to take the script get the images called thumb_imagename.jpg...

Any ideas :'(
Dan

L?KE
31-01-2009, 08:12 PM
Get them to enter the name of the normal photograph, and then assuming you're using PHP, do this for the thumb:



<?php

$photo = "imagename.jpg";
$thumb = "thumb_" . $photo;

?>


not sure if that helps, but I couldn't tell exactly what you meant.

DarrenToogood
31-01-2009, 08:14 PM
Have you got any more information on this system?

Luno1599
31-01-2009, 08:23 PM
Get them to enter the name of the normal photograph, and then assuming you're using PHP, do this for the thumb:



<?php

$photo = "imagename.jpg";
$thumb = "thumb_" . $photo;

?>
not sure if that helps, but I couldn't tell exactly what you meant.

Thats not that I ment, I mean say I have 15 image files in a folder and I wanted them in a list and the folder the files where in was called "studio" and thats in the database, the script finds out that the folder where the images are is in the folder "studio" then echos all the images in a 4x* table,
Do you understand me better...



Have you got any more information on this system?
Please PM me and I will let you know!

Dan

Luno1599
31-01-2009, 09:31 PM
I have come up with this...



$result = mysql_query("EDITED!!!");

echo "<p><table border=0 cellspacing=0 cellpadding=2 bordercolor=#eeeeee class='table' width=100%>";
echo "<tr align=top class='tdtop'>
<td colspan='4' class='tdtop'><b>View Gallery</b></td>
</tr>";

while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$images = $row["images"];


$handle = opendir('../images/photos/test/thumb');
while (false !== ($file = readdir($handle))){
echo " <tr>
<td width='25%' align='center'><img src='../images/photos/test/thumb/$file' width='100' height='100'></td>
<td width='25%' align='center'><img src='../images/photos/test/thumb/$file' width='100' height='100'></td>
<td width='25%' align='center'><img src='../images/photos/test/thumb/$file' width='100' height='100'></td>
<td width='25%' align='center'><img src='../images/photos/test/thumb/$file' width='100' height='100'></td>
</tr>";
}


}
closedir($handle);
echo "</table>";
?>
A screenshot of what it produces...
http://www.webhostingtalk.com/attachment.php?attachmentid=14165&d=1233437329

As you can see it echos the same image 4 times and echos 2 blanks for ./ and ../ can someone fix it for me?

Dan

PS top of the script has been edited for secruty

Joe!
01-02-2009, 11:19 AM
You've reminded me of a gallery script I was producing, I remember that I used a database to get the locations of the images, none of this opendir stuff. I'll upload mine when I get on the pc. I'm not too sure on how the dir stuff works, but i would assume that you need to get an array of all the files.

Luno1599
01-02-2009, 11:42 AM
Thanks mate

Want to hide these adverts? Register an account for free!