Scripts
Afbeelding uit map halen, netjes in table plaatsen
Door middel van dit script kan je afbeeldingen uit een map weergeven op deze manier: [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] Netjes onder elkaar in een table. Het is een simpel script, ik ben dan ook geen gevorden scripter. Voorbeeld vind je op de voorbeeld link bovenaan. Met dank aan: Jason de Ridder
afbeelding-uit-map-halen-netjes-in-table-plaatsen
[code]<?php
echo '
<b>Emoticons: </b>
<table cellspacing="0" cellpadding="0" style="border:solid 2px #000000;">
<tr>
<td>
<table cellspacing="0" cellpadding="5" width="100%">';
$image_types = array("jpg","gif","bmp","png","jpeg");
$plaatjes_reeks = "";
$mapnaam = "/emoticon";
if ( ereg('..',$mapnaam) || ereg('//',$mapnaam) ){
$mapnaam = "/emoticon";
}
$map = opendir(".{$mapnaam}");
$count = 0;
while (false!==($bestand = readdir($map))) {
if ($bestand != "." && $bestand != "..") {
$ext = explode('.',$bestand);
$extl = sizeof($ext) - 1;
$ext = strtolower($ext[$extl]);
if ( in_array($ext,$image_types) ){
if($count%3 == 0) {
$plaatjes_reeks .= '</tr><tr>';
}
$plaatjes_reeks .= "<td><img src=\"emoticon/" . $bestand . "\" /></td>";
$count++;
}
}
}
if ( $plaatjes_reeks != "" ){
echo ($plaatjes_reeks);
}
closedir($map);
echo '
</table>
</td>
</tr>
</table>';
?> [/code]
Reacties
0