489,9 → 489,18 |
|
public function convertirIdBddVersNomFichier($id, $format, $extension = 'jpg') { |
// creation du format original |
$id_avec_zeros = sprintf('%09s', $id) ; |
$id_avec_zeros_underscores = wordwrap($id_avec_zeros, 3 , '_', true) ; |
$id_avec_zeros = sprintf('%09s', $id); |
$id_avec_zeros_underscores = wordwrap($id_avec_zeros, 3 , '_', true); |
|
// déterminationnage de l'extension |
$path = $this->obtenirDossierPourFormat($id, $format); |
foreach(['jpg', 'JPG', 'png', 'PNG'] as $ext) { |
if (file_exists($path.'/'.$id_avec_zeros_underscores.'_'.$format.'.'.$ext)) { |
$extension = $ext; |
break; |
} |
} |
|
$nom_fichier = $id_avec_zeros_underscores.'_'.$format.'.'.$extension; |
|
return $nom_fichier; |