Hi there,
Is it possible to write description about an image without storing it in a db?

I have a photo gallery and instead of using a database, I have used the dir() function to read all the files in the folder then put it in an array.

It works fine but now I want selected images to have description.
For Example:
I have this array of images:
[0] => image1.jpg
[1] => image2.jpg
[2] => image3.jpg
[3] => image4.jpg
[4] => image5.jpg
Now if I want to write description for just [1] and [4] then how do I do that and where will it be stored?

I have read about putting them into a txt file but I don't have a clue where to start!

Another small problem is I want the images to be sorted in date taken! I have read about using the filemtime() function but dont know hoe to use it properley so can someone point me in the right direction.

Hope you guys can help!


7 Years
Discussion Span
Last Post by pzuurveen

This is what my code looks like:

include 'includes/functions.inc.php';
$filepath = "files/images/malaysia";
$dirPath = dir($filepath);
$imgArray = array();
while (($file = $dirPath->read()) !== false)
  if ((substr($file, -3)=="JPEG") || (substr($file, -3)=="jpg") || (substr($file, -3)=="JPG"))
     $imgArray[ ] = trim($file);
$c = count($imgArray);
for($i=0; $i<$c; $i++)
//echo $imgArray[$i];
			echo"<a class='thumb' name='leaf' href='$filepath/$imgArray[$i]'title='Title #1'>";
    echo'<img src="' . $filepath . '/' . $imgArray[$i] . '" width="65px" height="65px" /></a>';
    echo'<div class="caption">
									<div class="image-title"></div>
									<div class="image-desc"></div>';

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.