plaatjes weergeven na scandir

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior, Medior and Junior SAP HANA Developer

Vacature details Vakgebied: Software/IT Opleiding: Medior Werklocatie: Veldhoven Vacature ID: 12696 Introductie Our client is the world's leading provider of lithography systems for the semiconductor industry, manufacturing complex machines that are critical to the production of integrated circuits or chips. Our purpose is “unlocking the potential of people and society by pushing technology to new limits”. We do this guided by the principles “Challenge”, “Collaborate” and “Care”. Wat verwachten we van jou? SAP Certified Application Associate - SAP HANA Cloud Modeling (training and/or certification) Bachelor degree or higher Excellent understanding of SAP HANA (2.0 / Cloud), Data Modelling and writing

Bekijk vacature »

Pieter Joordens

Pieter Joordens

11/02/2009 17:55:00
Quote Anchor link
Ik heb een simpel script geschreven dat directories scant, en de plaatjes die erin zitten weergeeft op de volgende pagina. Echter werkt het niet helemaal.. waar zit hier de fout?

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<html>
    <head>
        <title>Foto Display<?php if( isset( $_GET['dir'] ) ) { echo " - ". $dir; } ?></title>
    </head>

    <body>
    <?php

    if ( !isset ( $_GET['dir'] ) )
    {

        $aDirs = scandir ('/fotos/') ;
        echo "<ul type='disc'>";
        foreach( $aDirs as $Dir ) {
            if ( is_dir ( $Dir ) )
            {

                if ( $Dir != "." or $Dir != ".." )
                {

                echo "<li><a href='./fotodownload.php?dir=". $dir ."'>". $dir ."</a></li>";
                }
            }
        }

        echo "</ul>";
    }

    elseif ( isset ( $_GET['dir'] ) )
    {

        echo "Je bekijkt nu de fotos van ". $_GET['dir'] .". <a href='./fotodownload.php'>Selecteer hier een andere map.</a>";
        $sDir = $_GET['dir'];
        $aFotos = scandir('./fotos/'. $sDir .'/images/');
        foreach ( $aFotos as $sFoto )
        {

            if ( !is_dir( $sFoto ) )
            {

                if ( strstr( $sFoto ) == ".jpg" or strstr( $sFoto ) == ".bmp" or strstr( $sFoto ) == ".jpeg" or strstr( $sFoto ) == ".gif" )
                {

                    echo "<a href='./fotos/". $aDir ."/images/". $sFoto ."'><img src='./fotos/". $aDir ."/images/". $sFoto ."' /></a>";
                }
            }
        }
    }

    ?>

    </body>
    </html>


Als er een $_GET['dir'] geset is dan geeft ie de regel bovenaan wel weer, maar geen plaatjes oid
als er geen $_GET['dir'] geset is dan geeft ie alleen 1 listitem waar nix achterstaat.. Wat doe ik fout?

btw ik heb php 5.1.4 op mijn server.
Gewijzigd op 01/01/1970 01:00:00 door Pieter Joordens
 
PHP hulp

PHP hulp

19/04/2024 08:41:35
 
Joren de Wit

Joren de Wit

11/02/2009 17:59:00
Quote Anchor link
Print de inhoud van $aDirs en $aFotos eens op het scherm en controleer of er wel datgene in staat dat jij zou verwachten...
 
Eddy E

Eddy E

11/02/2009 18:00:00
Quote Anchor link
Weet je zeker dat het map-ding goed is?
Dus:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
<?php
// jouw code:
$aDirs = scandir ('/fotos/') ;

// mogelijk?
$aDirs = scandir ('fotos/');
$aDirs = scandir ('./fotos/');
$aDirs = scandir ('../fotos/');
?>
 
Pieter Joordens

Pieter Joordens

11/02/2009 18:22:00
Quote Anchor link
als ik die $aDirs en $aFotos echo dan geeft ie alleen het woord Array, voor beide vars weer, voor de rest niet.
de map fotos zit in dezelfde map als waar het script in staat:

wwwroot
-index.php
-fotodownload.php
-fotos
--map
---images
----een hoop fotos
---thumbnails
----een hoop thumbnails
--map
---enz..
Gewijzigd op 01/01/1970 01:00:00 door Pieter Joordens
 
Eddy E

Eddy E

11/02/2009 18:29:00
Quote Anchor link
geef eens een print_r() op die arrays...
 
Pieter Joordens

Pieter Joordens

11/02/2009 20:55:00
Quote Anchor link
Dan geeft ie wel de mappen weer die hij moet doen ;) maar hij zet ze nog steeds nie in een list.. :s
 
Pieter Joordens

Pieter Joordens

11/02/2009 21:32:00
Quote Anchor link
laat maar.. het is al gelukt met andere hulp ;) toch bedankt allemaal :)
Gewijzigd op 01/01/1970 01:00:00 door Pieter Joordens
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.