Welcome Guest, Not a member yet? Register   Sign In
Code compatible with CodeIgniter
#1

[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?




Theme © iAndrew 2016 - Forum software by © MyBB