I'm following an excellent tutorial on youtube http://www.youtube.com/watch?v=IUh2uFjoeKE&playnext=1&videos=OidNLx_cEt8 and I'm up to part 3 where I am actually fetching the data in my album structure:
data)contains): - album1, album2, album3, album4, thumbs
album1,2,3,4 (contains pics specified)
thumbs (contains all pics with same filenames as they are in albums but are just a heap of pics; as opposed to organized like in albums). So the php must determine what files are needed then grab them through thumbs. I would've thought that they needed to be in folders like in albums but - this guy is obviously a pro and it's clearly do-able how he's done it and I'm not knocking as it's by far better to save organising a load more folders when the computer can do the work
- it's just I can't understand it at the moment.
Back to topic I manage to get to the stage where I can call out the filenames in the folder, but I cannot manage to get the images to be displayed. I can display the albums and resize them as thumbnails but with lightbox in the later stage - will not work properly and I should be able to follow the tutorial as it's done and bit lost here.
The only way I have deviated is I created not to show files called '.DS_Store' as I was somehow showing up hidden files presumably created by camera. I removed this code and still didn't work so must be different error. Here it is live http://www.preciseformwork.co.uk/hard/album.php
I must have a little comma out or something but cannot find what I've done as searched the code on youtube and can't see where I've gone wrong yet. I am not to the stage of installing lightbox yet which looks very simple.
Out of interest would it be more seo friendly to create this as a database with categorised sections?
Any input welcomed
.
data)contains): - album1, album2, album3, album4, thumbs
album1,2,3,4 (contains pics specified)
thumbs (contains all pics with same filenames as they are in albums but are just a heap of pics; as opposed to organized like in albums). So the php must determine what files are needed then grab them through thumbs. I would've thought that they needed to be in folders like in albums but - this guy is obviously a pro and it's clearly do-able how he's done it and I'm not knocking as it's by far better to save organising a load more folders when the computer can do the work
Back to topic I manage to get to the stage where I can call out the filenames in the folder, but I cannot manage to get the images to be displayed. I can display the albums and resize them as thumbnails but with lightbox in the later stage - will not work properly and I should be able to follow the tutorial as it's done and bit lost here.
The only way I have deviated is I created not to show files called '.DS_Store' as I was somehow showing up hidden files presumably created by camera. I removed this code and still didn't work so must be different error. Here it is live http://www.preciseformwork.co.uk/hard/album.php
I must have a little comma out or something but cannot find what I've done as searched the code on youtube and can't see where I've gone wrong yet. I am not to the stage of installing lightbox yet which looks very simple.
Out of interest would it be more seo friendly to create this as a database with categorised sections?
Any input welcomed
PHP:
<html>
<head>
</head>
<body>
<?php
$page = $_SERVER ['PHP_SELF'];
//settings
$column = 5;
//directories
$base = "data";
$thumbs = "thumbs";
//get album
$get_album = $_GET['album'];
if (!$get_album)
{
echo "<p>select an album<p/>";
$handle = opendir($base);
while (($file = readdir($handle)) !==FALSE)
{
if (is_dir($base."/".$file) && $file != "." && $file != ".." && $file != $thumbs)
{
echo "<a href='$page?album=$file'>$file</a></br>";
}
}
}
else
{
if (!is_dir($base."/".$get_album) || strstr($get_album,".") !=NULL || strstr($get_album,"/")!=NULL || strstr($get_album,"\\")!=NULL)
{
echo "Album does not exist";
}
else
{
echo "<b>$get_album</b></p>";
$handle = opendir($base."/".$get_album);
while (($file = readdir($handle)) !== FALSE)
{
if ($file != "." && $file != ".." && $file != ".DS_Store")
{
echo "<img src='$base/$thumbs/$file'></br>";
}
}
}
}
?>
</body>
</html>