Why not just look at the pictures names in the directory and return the ones for your user ?
$ext = array('jpeg', 'png', 'jpg');
$dir = 'images/';
$user = $_REQUEST['user'];
// the length of your username (for the expression bellow)
$usernamelength = strlen($user);
// read a list of all files into an array
$filesindirarray = scandir($dir);
// loop through the list
foreach($filesindirarray as $filename)
{
// does the filename start with
if(substr($filename,0,($usernamelength+8)) == $user .'_gallery')
{
// fish out the files extension
$fileext = pathinfo($filename, PATHINFO_EXTENSION);
// if the extension of the files is in your list
if(in_array($fileext,$ext))
// add to images
}
}