Good morning.
Someone will know by chance how I can show only the current profile image with PHP
Currently I have this like this:
$path = "files/".$id;
if(file_exists($path)){
$directorio = opendir($path);
while ($archivo = readdir($directorio)){
if (!is_dir($archivo)){
echo "<div data='".$path."/".$archivo."'><a href='".$path."/".$archivo."' title='Ver Imagen'><span class='glyphicon glyphicon-picture'></span></a>";
echo "$archivo <a href='#' class='delete' title='Eliminar' ><span class='glyphicon glyphicon-trash' aria-hidden='true'></span></a></div>";
echo "<img src='files/$id/$archivo' width='300' />";
}
}
}
But in doing this, all the profile pictures that the current user has are shown, and I just want you to show me the last one that came up.
I made these changes but it's not there yet:
$path = "files/".$id;
if(file_exists($path)){
chmod($path, 0777);
unlink($path);
$directorio = opendir($path);
while ($archivo = readdir($directorio)){
if (!is_dir($archivo)){
echo "<img src='files/$id/$archivo' width='200' height='200' 'image-align:center'/>";
}
}
}