I need help to display all my pictures in my folder in a row, not over each other.
JavaScript
x
<?php
$files = glob("bilder/*.*");
for ($i=1; $i<count($files); $i++)
{
$image = $files[$i];
$supported_file = array(
'gif',
'jpg',
'jpeg',
'png'
);
$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
if (in_array($ext, $supported_file)) {
echo '<img src="'.$image .'" width="400" height="500" />'."<br /><br />";
} else {
continue;
}
}
?>
Advertisement
Answer
You should use css classes and styles.
JavaScript
echo '<img src="'.$image .'" class="someClass" />';
Then include your stylesheet in html head
JavaScript
<link rel="stylesheet" href="stylesheet.css">
and finally style your images in that stylesheet.css
JavaScript
.someClass{
display: inline-block;
padding: 3px;
}
All of this is the most basic html and css stuff. Please consider reading some tutorials before asking questions.