i want to display my image from a folder but its not work what i change in code to work

 <?php

$dir_path = "/xampp/htdocs/image/";
$extensions_array = array('jpg','png','jpeg');

if(is_dir($dir_path))
{
    $files = scandir($dir_path);

    for($i = 0; $i < count($files); $i++)
    {
        if($files[$i] !='.' && $files[$i] !='..')
        {
            // get file name
            echo "File Name -> $files[$i]<br>";

            // get file extension
            $file = pathinfo($files[$i]);
            $extension = $file['extension'];
            echo "File Extension-> $extension<br>";

           // check file extension
            if(in_array($extension, $extensions_array))
            {
            // show image
            echo "<img src='$dir_path$files[$i]' style='width:100px;height:100px;'><br>";
            }
        }
    }
}

Firstly, I'd check that the is_dir command is workinf correctly. Which folder are you running the script from? I doubt '/xampp/htdocs/image' is relative to where the script is running and it isn't an absolute path.
Add more echos to ascertain which code is running and where it stops. At least that way you'll be able to narrow down where the proble is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.