Jump to content

kylehamilton

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kylehamilton's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't know how to implement that. Would you be able to modify my code? I would be deeply indebted
  2. I have the following code which displays images and captions from a directory. I would like the images to be displayed in the order they were created. Somebody suggested I use glob(), but I have no idea how. <?php $dir = "exclusive_images/"; if ($opendir = opendir($dir)) { //read directory while(($file = readdir($opendir)) !==FALSE) { if ( file_exists($dir.'/'.$file) && in_array( strtolower(pathinfo($file,PATHINFO_EXTENSION )), array('png','jpg','jpeg','gif'))) { if (file_exists($dir.'/'.$file. '.txt')) $caption = file_get_contents($dir.'/'.$file. '.txt'); else $caption = ucwords(str_replace(array('-','_'),' ', substr($file, 0, (strlen ($file)) - (strlen (strrchr($file,'.')))))); echo '<tr><td><img src="' . $dir.'/'.$file .'" alt="'. $file .'" title="' . $file . '" width="200"></td><td>' . $caption . '</td></tr>'; } } } ?>
×
×
  • 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.