473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating image gallery

Hi there,

I'm trying to create a fully automatic image gallery. I already have
the page
that automatically creates the index of thumbnails.

What i want now, is to create a page which indexes which galleries
there are;
each gallery is in a folder, so it has to check for folders, and if it
excists
automatically grab the first thumbnail, and put it in a table, and it
puts the
name of the gallery/folder beneath it.

I already got this far, but what i want, is that you get 4 thumbnails
next to
each other, and then automatically the next row.

What i have is the next code:

<?php

$the_array = Array();
$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.php") { /* as
descripted below: these "files" will not be added to the array */
$the_array[] = $file;
}
}
closedir($handle);

foreach ($the_array as $element) {
echo "<table width=104 height=104 border=0 cellpadding=0
cellspacing=0 class=pictable>
<tr>

<td align=center valign=middle><a href=./$element target=_self
onFocus=this.blur()><img src=./$element/tmb/01.gif alt=$element
width=90 height=90 border=0></a></td>
</tr>
</table>";} ?>
So every gallery has the same structure: index.php, and 2 folders; pix
& tmb

What i want is:
_________________________________
| | | | | | | |
| | | | | | | |
| img | | img | | img | | img |
| | | | | | | |
_________________________________
_________________________________
| | | | | | | |
| | | | | | | |
| img | | img | | img | | img |
| | | | | | | |
_________________________________

Hope this is clear:

I only want a table, if there is a folder.
Between every table, i want a column, so the 4
images are equally spread.

Sorry for the long question...

Greetz Krunkelgarten
Jul 17 '05 #1
1 2533
Bob
Hi, as far as i understand you wanna to display photos 4 X 2 in a
table?!
It's pretty simple, here is example how to display 3 X 3 you can see
it at http://haifa.us.
$arr_len=count($picsArr);
echo "<table cellspacing=\"2\" cellpadding=\"2\" border=\"0\"
width=100%>";
echo "<tr>";
for($i=0; $i<$arr_len;$i++){
if(is_string($picsArr[$i]))
echo "<td><div class=\"presentation\">".$picsArr[$i]."</div></td>";

this is most important part, it's close </tr> row on specific number,
for example on photo number 3(0,1,2) the first row will be created and
you'll go to row #2!
if($i==2 || $i==5 || $i==8)
echo"</tr><tr>";
}

let me kno if you have any questions!
kr***********@hotmail.com (krunkelgarten) wrote in message news:<87**************************@posting.google. com>...
Hi there,

I'm trying to create a fully automatic image gallery. I already have
the page
that automatically creates the index of thumbnails.

What i want now, is to create a page which indexes which galleries
there are;
each gallery is in a folder, so it has to check for folders, and if it
excists
automatically grab the first thumbnail, and put it in a table, and it
puts the
name of the gallery/folder beneath it.

I already got this far, but what i want, is that you get 4 thumbnails
next to
each other, and then automatically the next row.

What i have is the next code:

<?php

$the_array = Array();
$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.php") { /* as
descripted below: these "files" will not be added to the array */
$the_array[] = $file;
}
}
closedir($handle);

foreach ($the_array as $element) {
echo "<table width=104 height=104 border=0 cellpadding=0
cellspacing=0 class=pictable>
<tr>

<td align=center valign=middle><a href=./$element target=_self
onFocus=this.blur()><img src=./$element/tmb/01.gif alt=$element
width=90 height=90 border=0></a></td>
</tr>
</table>";} ?>
So every gallery has the same structure: index.php, and 2 folders; pix
& tmb

What i want is:
_________________________________
| | | | | | | |
| | | | | | | |
| img | | img | | img | | img |
| | | | | | | |
_________________________________
_________________________________
| | | | | | | |
| | | | | | | |
| img | | img | | img | | img |
| | | | | | | |
_________________________________

Hope this is clear:

I only want a table, if there is a folder.
Between every table, i want a column, so the 4
images are equally spread.

Sorry for the long question...

Greetz Krunkelgarten

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Perttu Pulkkinen | last post by:
Does anybody know a php-based image gallery, where final looks of the actual site would not be determined by the application? I mean that there would only be a php-library of objects/functions that...
4
by: sepgy | last post by:
Can anyone help me to use a python to create an HTML photo gallery generator. When it's finished, it will be able find all the picture files (i.e. .jpg, .gif. .png files) in any given folder on the...
8
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client...
6
by: ste | last post by:
Hi there, I'm just beginning to learn PHP and MySQL, but I'm finding it difficult! I wondered if someone could help me out with a problem I'm having, or at least point me in the right...
10
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however many rows it takes) in order to create a basic...
4
by: RE Kochanski | last post by:
I have attempted to use the CSS techniques from two or three sites to create a CSS only image gallery. I am muddling the affair by placing the thumbnails in one float, the page text in another...
1
by: gescom | last post by:
My goal is to create essentially two galleries on a single page, in which the first gallery determines what the second gallery displays. For instance, the first gallery refers to the contents of the...
5
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers to an external javascript file which I have...
10
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.