Mise en forme de texte bizarre
Bonjour à tous,
J'ai une fonction qui permet d'afficher les images d'un répertoire l'une sous l'autre sur un téléphone et 3 par 3 sur un PC.
Pas de souci, ça marche.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| <?php
function Affiche_images($chemin, $detect)
{
$images = array();
//----- Récupère les images
$scandir = scandir($chemin);
$nb_fichiers = count($scandir);
$nb_fichiers = $nb_fichiers - 2;
//echo 'Nb fichiers : '.$nb_fichiers."<br><br>";
//----- Met les infos dans un tableau
for($i=2;$i<=$nb_fichiers+1;$i++)
{
$infos_image = @getImageSize($chemin.$scandir[$i]);
$images[$i-1][0] = $chemin.$scandir[$i]; //----- Nom image
}
//----------------------------------------------------- Visualisation Mobile
if ($detect==1)
{
echo "<table 100% border = 0>";
for($i=1;$i<=$nb_fichiers;$i++)
{
echo"<tr width='100%'>";
if(pathinfo($images[$i][0], PATHINFO_EXTENSION) == 'mp4')
{echo"<video src=".$images[$i][0]." border='0' width='640' height='480' controls>";}
else
{echo"<img src=".$images[$i][0]." border='0'>";}
echo "</tr>";
}
echo "</table>";
}
else
//------------------------------------------------------ Visualisation PC
{
echo "<table 100% border = 0>";
for($i=1;$i<=$nb_fichiers;$i+=3)
{
echo"<tr width='100%'>";
if(pathinfo($images[$i][0], PATHINFO_EXTENSION) == 'mp4')
{echo"<td width='33%' align='center'><video src=".$images[$i][0]." border='0' width='440' height='340' controls></td>";}
else {echo"<td width='33%' align='center'><img src=".$images[$i][0]." border='0'></td>";}
if(pathinfo($images[$i+1][0], PATHINFO_EXTENSION) == 'mp4')
{echo"<td width='33%' align='center'><video src=".$images[$i+1][0]." border='0' width='440' height='340' controls></td>";}
else {echo"<td width='33%' align='center'><img src=".$images[$i+1][0]." border='0'></td>";}
if(pathinfo($images[$i+2][0], PATHINFO_EXTENSION) == 'mp4')
{echo"<td width='33%' align='center'><video src=".$images[$i+2][0]." border='0' width='440' height='340' controls></td>";}
else {echo"<td width='33%' align='center'><img src=".$images[$i+2][0]." border='0'></td>";}
echo "</tr>";
}
echo "</table>";
}
}
?> |
J'ai du code qui appelle cette fonction plusieurs fois.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <!DOCTYPE html>
<html>
<head>
<style>
.titre1
{
font-family: "Arial Black";
font-size: 24px;
font-weight : bold;
}
.titre2
{
font-family: "Arial Black";
font-size: 16px;
}
img
{
max-width : 95%;
height : auto;
}
</style>
</head>
<?php
require_once 'includes/Mobile_Detect.php';
$detect = new Mobile_Detect();
if ($detect->isMobile()) {$mobile=1;}else{$mobile=0;}
include("includes/fonctions.php");
echo"<body>
<form><input type='button' value='☰ Menu' style='width:200px height:180px' onclick='history.go(-1)'>";
//----- Début d'affichage du circuit
echo"<center><p class='titre1'>Andalousie du 3 au 25 septembre 2021</p><br>";
echo"<br><br><center><p class='titre2'>La carte et le circuit en partant de France</p><br>";
Affiche_images('photos/andalousie/_circuit/', $mobile);
echo"<br><br><center><p class='titre2'>Le désert de Tabernas proche d'Alméria avec un village western</p><br>";
Affiche_images('photos/andalousie/tabernas/', $mobile);
echo"<br><br><center><p class='titre2'>Guadix avec ses maisons troglodytes, son marché et les champs d'oliviers</p><br>";
Affiche_images('photos/andalousie/guadix/', $mobile);
echo"<br><br><center><p class='titre2'>L'Alhambra à Grenade, un des monuments le plus célèbre et le plus visité d'Espagne, avec les palais nasrides, l'Alcazaba et le Generalife<br>
Attention, il faut réserver au moins 1 an à l'avance sur internet</p><br>";
Affiche_images('photos/andalousie/alhambra/', $mobile);
?>
</form>
</body>
</html> |
Tout fonctionne bien sur un PC, par contre sur un téléphone, les premiers textes ne respectent pas la mise en forme alors que plus loin les textes respectent la class titre2.
Sur téléphone les textes sont minuscules au début et normaux plus loin ?
Si quelqu'un a une idée, je suis preneur. Merci