Q:

get images from folder based on variables

I try to get all the images from a folder with this code.
the result is not correct because the code echo a "/" too much (just like below)
Someone please help!
        $dirname = 'uploads/'.$email.'/'.$product_id.'/';
        $images = glob($dirname."*");

        foreach($images as $image) {
            echo '<img src="'.$image.'" /><br />';
        }

<img src="uploads/test@test.com//52">

This is the desired result:
<img src="uploads/test@test.com/52/">

This is the final result..
Thank to Rakesh Shetty thank you!
$product_id = $row['product_id'];
$dirname = 'uploads/'.$email.'/'.$product_id.'/';

$files = glob($dirname."*.*");

print_r($files); // check what you get

    for ($i=1; $i<count($files); $i++){
      $num = $files[$i];
      echo '<img src="'.$num.'" /> ';
}

print_r($files);

A:

Try this : Source
$dirname = 'uploads/'.$email.'/'.$product_id.'/';

$files = glob($dirname."*.*");

print_r($files); // check what you get

    for ($i=1; $i<count($files); $i++)
    {

      $num = $files[$i];
      echo '<img src="'.$num.'" /> ';

    }

