CodeIgniter Forums

Full Version: Code compatible with CodeIgniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Gabi3xz[/eluser]
I have a code which extract images from a folder.
Code:
$dir = base_url().'images/user';
$file_display = array('jpg', 'jpeg', 'png', 'gif');

if (file_exists($dir) == false) {
   $images = 'nu sunt';
} else {
   $dir_images = scandir($dir);

   $images = '<div>';
    foreach ($dir_images as $file) {
     $file_type = strtolower(end(explode('.', $file)));
     if ($file !== '.' && $file !== '..' && in_array($file_type, $file_display) == true) {
     $images .= '<a href="#"><img src="'.base_url().'/'.$dir.'/'.$file.'" alt="'.$file.'" /></a>';
     }
    }
   $images .= '</div>';
}
Says that it has certain functions compatible. "scandir"
What can I do?