IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Pb gallerie photos


Sujet :

Langage PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    209
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 209
    Par défaut Pb gallerie photos
    Bonjour,

    Sur le site de mon club de plongée, j'ai mis une gallérie photos.
    Seulement, les vignettes ne s'affichent pas.

    Voici le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
     
    <?php
    //-----------------------
    // Debug stuff
    //-----------------------
    error_reporting(E_ERROR);
    error_reporting(E_ALL);
    error_reporting(0);
     
    $mtime = microtime();
    $mtime = explode(" ",$mtime);
    $mtime = $mtime[1] + $mtime[0];
    $starttime = $mtime;
     
    $version = "0.3.5";
    ini_set("memory_limit","256M");
     
    require("config_default.php");
    include("config.php");
     
    //-----------------------
    // DEFINE VARIABLES
    //-----------------------
    $page_navigation = "";
    $breadcrumb_navigation = "";
    $thumbnails = "";
    $new = "";
    $images = "";
    $exif_data = "";
    $messages = "";
    $comment = "";
     
     
    //-----------------------
    // PHP ENVIRONMENT CHECK
    //-----------------------
    if (!function_exists('exif_read_data') && $display_exif == 1) {
        $display_exif = 0;
        $messages = "Error: PHP EXIF is not available. Set $display_exif = 0; in config.php to remove this message";
    }
     
    //-----------------------
    // FUNCTIONS
    //-----------------------
    function is_directory($filepath) {
        // $filepath must be the entire system path to the file
        if (!@opendir($filepath)) return FALSE;
        else {
            return TRUE;
            closedir($filepath);
        }
    }
     
    function padstring($name, $length) {
        global $label_max_length;
        if (!isset($length)) $length = $label_max_length;
        if (strlen($name) > $length) {
            return substr($name,0,$length) . "...";
        } else return $name;
    }
    function getfirstImage($dirname) {
        $imageName = false;
        $ext = array("jpg", "png", "jpeg", "gif", "JPG", "PNG", "GIF", "JPEG");
        if($handle = opendir($dirname))
        {
            while(false !== ($file = readdir($handle)))
            {
                $lastdot = strrpos($file, '.');
                $extension = substr($file, $lastdot + 1);
                if ($file[0] != '.' && in_array($extension, $ext)) break;
            }
            $imageName = $file;
            closedir($handle);
        }
        return($imageName);
    }
    function readEXIF($file) {
        $exif_data = "";
        $exif_idf0 = exif_read_data ($file,'IFD0' ,0 );
        $emodel = $exif_idf0['Model'];
     
        $efocal = $exif_idf0['FocalLength'];
        list($x,$y) = split('/', $efocal);
        $efocal = round($x/$y,0);
     
        $exif_exif = exif_read_data ($file,'EXIF' ,0 );
        $eexposuretime = $exif_exif['ExposureTime'];
     
        $efnumber = $exif_exif['FNumber'];
        list($x,$y) = split('/', $efnumber);
        $efnumber = round($x/$y,0);
     
        $eiso = $exif_exif['ISOSpeedRatings'];
     
        $exif_date = exif_read_data ($file,'IFD0' ,0 );
        $edate = $exif_date['DateTime'];
        if (strlen($emodel) > 0 OR strlen($efocal) > 0 OR strlen($eexposuretime) > 0 OR strlen($efnumber) > 0 OR strlen($eiso) > 0) $exif_data .= "::";
        if (strlen($emodel) > 0) $exif_data .= "$emodel";
        if ($efocal > 0) $exif_data .= " | $efocal" . "mm";
        if (strlen($eexposuretime) > 0) $exif_data .= " | $eexposuretime" . "s";
        if ($efnumber > 0) $exif_data .= " | f$efnumber";
        if (strlen($eiso) > 0) $exif_data .= " | ISO $eiso";
        return($exif_data);
    }
    function checkpermissions($file) {
        global $messages;
        if (substr(decoct(fileperms($file)), -1, strlen(fileperms($file))) < 4 OR substr(decoct(fileperms($file)), -3,1) < 4) $messages = "At least one file or folder has wrong permissions. Learn how to <a href='http://minigal.dk/faq-reader/items/how-do-i-change-file-permissions-chmod.html' target='_blank'>set file permissions</a>";
    }
     
    //-----------------------
    // CHECK FOR NEW VERSION
    //-----------------------
    //if (ini_get('allow_url_fopen') == "1") {
    //	$file = @fopen ("http://www.minigal.dk/minigalnano_version.php", "r");
    //	$server_version = fgets ($file, 1024);
    //	if (strlen($server_version) == 5 ) { //If string retrieved is exactly 5 chars then continue
    //		if (version_compare($server_version, $version, '>')) $messages = "MiniGal Nano $server_version is available! <a href='http://www.minigal.dk/minigal-nano.html' target='_blank'>Get it now</a>";
    //	}
    //	fclose($file);
    //}
     
    if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", "");
    $thumbdir = rtrim('photos' . "/" .$_REQUEST["dir"],"/");
    $thumbdir = str_replace("/..", "", $thumbdir); // Prevent looking at any up-level folders
    $currentdir = GALLERY_ROOT . $thumbdir;
     
    //-----------------------
    // READ FILES AND FOLDERS
    //-----------------------
    $files = array();
    $dirs = array();
    if ($handle = opendir($currentdir))
    {
        while (false !== ($file = readdir($handle)))
        {
            // 1. LOAD FOLDERS
            if (is_directory($currentdir . "/" . $file))
            {
                if ($file != "." && $file != ".." )
                {
                    checkpermissions($currentdir . "/" . $file); // Check for correct file permission
                    // Set thumbnail to folder.jpg if found:
     
                    if (file_exists("$currentdir/" . $file . "/folder.jpg"))
                    {
                        $dirs[] = array(
                            "name" => $file,
                            "date" => filemtime($currentdir . "/" . $file . "/folder.jpg"),
                            "html" => "<br><li3><a href='?page=galerie_photos&dir=" .ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span>
                            <img src='" . GALLERY_ROOT . "createthumb.php?filename=$currentdir/" . $file . "/folder.jpg&amp;size=$thumb_size'  alt='$label_loading' /></a></li>");
                    }  else
                    {
                        // Set thumbnail to first image found (if any):
                        unset ($firstimage);
                        $firstimage = getfirstImage("$currentdir/" . $file);
                        if ($firstimage != "") {
                            $dirs[] = array(
                                "name" => $file,
                                "date" => filemtime($currentdir . "/" . $file),
                                "html" => "<br><li3><a href='?page=galerie_photos&dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span>
                                    <img src='" . GALLERY_ROOT . "createthumb.php?filename=$thumbdir/" . $file . "/" . $firstimage . "&amp;size=$thumb_size'  alt='$label_loading' /></a></li>");
                        } else {
                            // If no folder.jpg or image is found, then display default icon:
                            $dirs[] = array(
                                "name" => $file,
                                "date" => filemtime($currentdir . "/" . $file),
                                "html" => "<br><li3><a href='?page=galerie_photos&dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file) . "</em><span></span>
                                    <img src='" . GALLERY_ROOT . "images/folder_" . strtolower($folder_color) . ".png' width='$thumb_size' height='$thumb_size' alt='$label_loading' /></a></li>");
                        }
                    }
                }
            }
     
            // 2. LOAD CAPTIONS
            if (file_exists($currentdir ."/captions.txt"))
            {
                $file_handle = fopen($currentdir ."/captions.txt", "rb");
                while (!feof($file_handle) )
                {
                    $line_of_text = fgets($file_handle);
                    $parts = explode('/n', $line_of_text);
                    foreach($parts as $img_capts)
                    {
                        list($img_filename, $img_caption) = explode('|', $img_capts);
                        $img_captions[$img_filename] = $img_caption;
                    }
                }
                fclose($file_handle);
            }
     
            // 3. LOAD FILES
            if ($file != "." && $file != ".." && $file != "folder.jpg")
            {
                // JPG, GIF and PNG
                if (preg_match("/.jpg$|.jpeg$|.gif$|.png$/i", $file))
                {
                    //Read EXIF
                    if ($display_exif == 1) $img_captions[$file] .= readEXIF($currentdir . "/" . $file);
     
                    checkpermissions($currentdir . "/" . $file);
                    $files[] = array (
                        "name" => $file,
                        "date" => filemtime($currentdir . "/" . $file),
                        "size" => filesize($currentdir . "/" . $file),
                        "html" => "<li3><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title='$img_captions[$file]'><span></span>
                                            <img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' />
                                        </a></li>");
                }
                // Other filetypes
                $extension = "";
                if (preg_match("/.pdf$/i", $file)) $extension = "PDF"; // PDF
                if (preg_match("/.zip$/i", $file)) $extension = "ZIP"; // ZIP archive
                if (preg_match("/.rar$|.r[0-9]{2,}/i", $file)) $extension = "RAR"; // RAR Archive
                if (preg_match("/.tar$/i", $file)) $extension = "TAR"; // TARball archive
                if (preg_match("/.gz$/i", $file)) $extension = "GZ"; // GZip archive
                if (preg_match("/.doc$|.docx$/i", $file)) $extension = "DOCX"; // Word
                if (preg_match("/.ppt$|.pptx$/i", $file)) $extension = "PPTX"; //Powerpoint
                if (preg_match("/.xls$|.xlsx$/i", $file)) $extension = "XLXS"; // Excel
     
                if ($extension != "")
                {
                    $files[] = array (
                        "name" => $file,
                        "date" => filemtime($currentdir . "/" . $file),
                        "size" => filesize($currentdir . "/" . $file),
                        "html" => "<li3><a href='" . $currentdir . "/" . $file . "' title='$file'><em-pdf>" . padstring($file, 20) . "</em-pdf><span></span><img src='" . GALLERY_ROOT . "images/filetype_" . $extension . ".png' width='$thumb_size' height='$thumb_size' alt='$file' /></a></li>");
                }
            }
        }
        closedir($handle);
    } else die("ERROR: Could not open ".htmlspecialchars(stripslashes($currentdir))." for reading!");
    echo "<br><br><br>";
    //-----------------------
    // SORT FILES AND FOLDERS
    //-----------------------
    if (sizeof($dirs) > 0)
    {
        foreach ($dirs as $key => $row)
        {
            if($row["name"] == "") unset($dirs[$key]); //Delete empty array entries
            $name[$key] = strtolower($row['name']);
            $date[$key] = strtolower($row['date']);
        }
        if (strtoupper($sortdir_folders) == "DESC") array_multisort($$sorting_folders, SORT_DESC, $name, SORT_DESC, $dirs);
        else array_multisort($$sorting_folders, SORT_ASC, $name, SORT_ASC, $dirs);
    }
    if (sizeof($files) > 0)
    {
        foreach ($files as $key => $row)
        {
            if($row["name"] == "") unset($files[$key]); //Delete empty array entries
            $name[$key] = strtolower($row['name']);
            $date[$key] = strtolower($row['date']);
            $size[$key] = strtolower($row['size']);
        }
        if (strtoupper($sortdir_files) == "DESC") array_multisort($$sorting_files, SORT_DESC, $name, SORT_ASC, $files);
        else array_multisort($$sorting_files, SORT_ASC, $name, SORT_ASC, $files);
    }
     
    //-----------------------
    // OFFSET DETERMINATION
    //-----------------------
    $offset_start = ($_GET["page_photo"] * $thumbs_pr_page) - $thumbs_pr_page;
    if (!isset($_GET["page_photo"])) $offset_start = 0;
    $offset_end = $offset_start + $thumbs_pr_page;
    if ($offset_end > sizeof($dirs) + sizeof($files)) $offset_end = sizeof($dirs) + sizeof($files);
     
    if ($_GET["page_photo"] == "all")
    {
        $offset_start = 0;
        $offset_end = sizeof($dirs) + sizeof($files);
    }
     
    //-----------------------
    // PAGE NAVIGATION
    //-----------------------
    if (!isset($_GET["page_photo"])) $_GET["page_photo"] = 1;
    if (sizeof($dirs) + sizeof($files) > $thumbs_pr_page)
    {
        $page_navigation .= "$label_page ";
        for ($i=1; $i <= ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page); $i++)
        {
            if ($_GET["page_photo"] == $i) {
                $page_navigation .= "$i";
            }
            else {
                $page_navigation .= "<a href='?page=galerie_photos&dir=" . $_GET["dir"] . "&amp;page_photo=" . ($i) . "'>" . $i . "</a>";
            }
            if ($i != ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page)) $page_navigation .= " | ";
        }
        //Insert link to view all images
        if ($_GET["page_photo"] == "all") $page_navigation .= " | $label_all";
        else {
            $page_navigation .= " | <a href='?page=galerie_photos&dir=" . $_GET["dir"] . "&amp;page_photo=all'>$label_all</a>";
        }
    }
     
    //-----------------------
    // BREADCRUMB NAVIGATION
    //-----------------------
    if ($_GET['dir'] != "")
    {
        $breadcrumb_navigation .= "<a href='?page=galerie_photos&dir='>" . $label_home . "</a> > ";
        $navitems = explode("/", $_REQUEST['dir']);
        for($i = 0; $i < sizeof($navitems); $i++)
        {
            if ($i == sizeof($navitems)-1) $breadcrumb_navigation .= $navitems[$i];
            else
            {
                $breadcrumb_navigation .= "<a href='?page=galerie_photos&dir=";
                for ($x = 0; $x <= $i; $x++)
                {
                    $breadcrumb_navigation .= $navitems[$x];
                    if ($x < $i) $breadcrumb_navigation .= "/";
                }
                $breadcrumb_navigation .= "'>" . $navitems[$i] . "</a> > ";
            }
        }
    } else $breadcrumb_navigation .= $label_home;
     
     
    //Include hidden links for all images BEFORE current page so lightbox is able to browse images on different pages
    for ($y = 0; $y < $offset_start - sizeof($dirs); $y++)
    {
        $breadcrumb_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]' class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
    }
     
    //-----------------------
    // DISPLAY FOLDERS
    //-----------------------
    if (count($dirs) + count($files) == 0) {
        $thumbnails .= "<li>$label_noimages</li>"; //Display 'no images' text
        if($currentdir == "photos") $messages = "It looks like you have just installed MiniGal Nano. Please run the <a href='system_check.php'>system check tool</a>";
    }
    $offset_current = $offset_start;
    for ($x = $offset_start; $x < sizeof($dirs) && $x < $offset_end; $x++)
    {
        $offset_current++;
        $thumbnails .= $dirs[$x]["html"];
    }
     
    //-----------------------
    // DISPLAY FILES
    //-----------------------
    for ($i = $offset_start - sizeof($dirs); $i < $offset_end && $offset_current < $offset_end; $i++)
    {
        if ($i >= 0)
        {
            $offset_current++;
            $thumbnails .= $files[$i]["html"];
        }
    }
     
    //Include hidden links for all images AFTER current page so lightbox is able to browse images on different pages
    for ($y = $i; $y < sizeof($files); $y++)
    {
        $page_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]'  class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
    }
     
    //-----------------------
    // OUTPUT MESSAGES
    //-----------------------
    if ($messages != "") {
        $messages = "<div id=\"topbar\">" . $messages . " <a href=\"#\" onclick=\"document.getElementById('topbar').style.display = 'none';\";><img src=\"images/close.png\" /></a></div>";
    }
     
    // Read folder comment.
    $comment_filepath = $currentdir . $file . "/comment.html";
    if (file_exists($comment_filepath))
    {
        $fd = fopen($comment_filepath, "r");
        $comment = utf8_encode(fread($fd,filesize ($comment_filepath))); // utf8_encode to convert from iso-8859 to UTF-8
        fclose($fd);
    }
     
     
    //PROCESS TEMPLATE FILE
    if(GALLERY_ROOT != "") $templatefile = GALLERY_ROOT . "templates/integrate.html";
    else $templatefile = "templates/" . $templatefile . ".html";
    if(!$fd = fopen($templatefile, "r"))
    {
        echo "Template ".htmlspecialchars(stripslashes($templatefile))." not found!";
        exit();
    }
    else
    {
        $template = fread ($fd, filesize ($templatefile));
        fclose ($fd);
        /*
        echo "<br>title : $title";
        echo "<br>messages : $messages";
        echo "<br>author : $author";
        echo "<br>gallery_root : $gallery_root";
        echo "<br>images : $images";
        echo "<br>thumbnails : $thumbnails";
        echo "<br>breadcrumb_navigation : $breadcrumb_navigation";
        echo "<br>page_navigation : $page_navigation";
        echo "<br>folder_comment : $comment";
        echo "<br>backgroundcolor : $backgroundcolor";
        echo "<br>gallery_width : $gallery_width";
        echo "<br>version : $version";
        */
        $template = stripslashes($template);
        $template = preg_replace("/<% title %>/", $title, $template);
        $template = preg_replace("/<% messages %>/", $messages, $template);
        $template = preg_replace("/<% author %>/", $author, $template);
        $template = preg_replace("/<% gallery_root %>/", GALLERY_ROOT, $template);
        $template = preg_replace("/<% images %>/", "$images", $template);
        $template = preg_replace("/<% thumbnails %>/", "$thumbnails", $template);
        $template = preg_replace("/<% breadcrumb_navigation %>/", "$breadcrumb_navigation", $template);
        $template = preg_replace("/<% page_navigation %>/", "$page_navigation", $template);
        $template = preg_replace("/<% folder_comment %>/", "$comment", $template);
        $template = preg_replace("/<% bgcolor %>/", "$backgroundcolor", $template);
        $template = preg_replace("/<% gallery_width %>/", "$gallery_width", $template);
        $template = preg_replace("/<% version %>/", "$version", $template);
        echo "$template";
    }
     
    //-----------------------
    //Debug stuff
    //-----------------------
    $mtime = microtime();
    $mtime = explode(" ",$mtime);
    $mtime = $mtime[1] + $mtime[0];
    $endtime = $mtime;
    $totaltime = ($endtime - $starttime);
    //echo "This page was created in ".$totaltime." seconds";
    ?>
    le fichier config.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    <?php
    /*
    MINIGAL NANO
    - A PHP/HTML/CSS based image gallery script
    
    This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
    You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
    
    MiniGal Nano is created by Thomas Rybak
    
    Copyright 2010 by Thomas Rybak
    Support: www.minigal.dk
    Community: www.minigal.dk/forum
    
    Please enjoy this free script!
    */
     
    // EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
    $thumbs_pr_page 		= "21"; //Number of thumbnails on a single page
    $gallery_width 			= "900px"; //Gallery width. Eg: "500px" or "70%"
    $backgroundcolor 		= "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
    $templatefile 			= "darkgold2"; //Template filename (must be placed in 'templates' folder)
    $title 					= "Gallerie photos du SCF"; // Text to be displayed in browser titlebar
    $author 				= "Subaqua Club du Faucigny";
    $folder_color 			= "black"; // Color of folder icons: blue / black / vista / purple / green / grey
    $sorting_folders		= "name"; // Sort folders by: [name][date]
    $sorting_files			= "name"; // Sort files by: [name][date][size]
    $sortdir_folders		= "ASC"; // Sort direction of folders: [ASC][DESC]
    $sortdir_files			= "ASC"; // Sort direction of files: [ASC][DESC]
     
    //LANGUAGE STRINGS
    $label_home 			= "Gallerie photos"; //Name of home link in breadcrumb navigation
    $label_new 				= "New"; //Text to display for new images. Use with $display_new variable
    $label_page 			= "Page"; //Text used for page navigation
    $label_all 				= "All"; //Text used for link to display all images in one page
    $label_noimages 		= "No images"; //Empty folder text
    $label_loading 			= "Loading..."; //Thumbnail loading text
     
    //ADVANCED SETTINGS
    $thumb_size 			= 240; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly! 
    $label_max_length 		= 30; //Maximum chars of a folder name that will be displayed on the folder thumbnail  
    $display_exif			= 0;
    ?>
    Voici également le fichier createthumb.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
     
    <?php
    /*
    MINIGAL NANO
    - A PHP/HTML/CSS based image gallery script
    
    This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
    You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
    
    MiniGal Nano is created by Thomas Rybak
    
    Copyright 2010 by Thomas Rybak
    Support: www.minigal.dk
    Community: www.minigal.dk/forum
    
    Please enjoy this free script!
    
    Version 0.3.5 modified by Sebastien SAUVAGE (sebsauvage.net):
       - Added thumbnail cache (reduces server CPU load, server bandwith and speeds up client page display).
       - Thumbnails are now always in JPEG even if the source image is PNG or GIF.
    
    USAGE EXAMPLE:
    File: createthumb.php
    Example: <img src="createthumb.php?filename=photo.jpg&amp;width=100&amp;height=100">
    */
    	error_reporting(E_ALL);
    //	error_reporting(0);
    /*
    if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) header('Content-type: image/jpeg');
    if (preg_match("/.gif$/i", $_GET['filename'])) header('Content-type: image/gif');
    if (preg_match("/.png$/i", $_GET['filename'])) header('Content-type: image/png');
    */
     
    	echo "<br>On est dans createthumb.php";
     
    function str_split_php4( $text, $split = 1 ) {
        // place each character of the string into and array
        $array = array();
        for ( $i=0; $i < strlen( $text ); ){
            $key = NULL;
            for ( $j = 0; $j < $split; $j++, $i++ ) {
                $key .= $text[$i];
            }
            array_push( $array, $key );
        }
        return $array;
    }
     
    function sanitize($name)
    {
    // Sanitize image filename (taken from http://iamcam.wordpress.com/2007/03/20/clean-file-names-using-php-preg_replace/ )
    $fname=$name;
    $replace="_";
    $pattern="/([[:alnum:]_\.-]*)/";
    $fname=str_replace(str_split_php4(preg_replace($pattern,$replace,$fname)),$replace,$fname);
    return $fname;
    }
     
    // Make sure the "thumbs" directory exists.
    if (!is_dir('../../thumbs')) { mkdir('../../thumbs',0700); }
     
    // Thumbnail file name and path.
    // (We always put thumbnails in jpg for simplification)
    $thumbname = '../../thumbs/'.sanitize($_GET['filename']).'.jpg';
    echo "<br>createthumb.php - thumbname : $thumbname";
    if (file_exists($thumbname))  // If thumbnail exists, serve it.
    {
        $fd = fopen($thumbname, "r");
        $cacheContent = fread($fd,filesize ($thumbname));
        fclose($fd);
        header('Content-type: image/jpeg');
        echo($cacheContent);
    }
    else // otherwise, generate thumbnail, send it and save it to file.
    {
     
    	// Display error image if file isn't found
    	if (!is_file($_GET['filename'])) {
    		header('Content-type: image/jpeg');
    		$errorimage = ImageCreateFromJPEG('../../images/Rhynopias_baillant.jpg');//questionmark.jpg');
    		ImageJPEG($errorimage,null,90);
    	}
     
    	// Display error image if file exists, but can't be opened
    	if (substr(decoct(fileperms($_GET['filename'])), -1, strlen(fileperms($_GET['filename']))) < 4 OR substr(decoct(fileperms($_GET['filename'])), -3,1) < 4) {
    		header('Content-type: image/jpeg');
    		$errorimage = ImageCreateFromJPEG('../../images/cannotopen.jpg');
    		ImageJPEG($errorimage,null,90);
    	}
     
    	// Define variables
    	$target = "";
    	$xoord = 0;
    	$yoord = 0;
     
        if ($_GET['size'] == "") $_GET['size'] = 120; //
        $imgsize = GetImageSize($_GET['filename']);
        $width = $imgsize[0];
        $height = $imgsize[1];
        if ($width > $height) { // If the width is greater than the height it’s a horizontal picture
            $xoord = ceil(($width-$height)/2);
            $width = $height;      // Then we read a square frame that  equals the width
        } else {
            $yoord = ceil(($height-$width)/2);
            $height = $width;
        }
     
        // Rotate JPG pictures
        if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) {
    		if (function_exists('exif_read_data') && function_exists('imagerotate')) {
    			$exif = exif_read_data($_GET['filename']);
    			$ort = $exif['IFD0']['Orientation'];
    			$degrees = 0;
    		    switch($ort)
    		    {
    		        case 6: // 90 rotate right
    		            $degrees = 270;
    		        break;
    		        case 8:    // 90 rotate left
    		            $degrees = 90;
    		        break;
    		    }
    			if ($degrees != 0)	$target = imagerotate($target, $degrees, 0);
    		}
    	}
     
             $target = ImageCreatetruecolor($_GET['size'],$_GET['size']);
             if (preg_match("/.jpg$/i", $_GET['filename'])) $source = ImageCreateFromJPEG($_GET['filename']);
             if (preg_match("/.gif$/i", $_GET['filename'])) $source = ImageCreateFromGIF($_GET['filename']);
             if (preg_match("/.png$/i", $_GET['filename'])) $source = ImageCreateFromPNG($_GET['filename']);
             imagecopyresampled($target,$source,0,0,$xoord,$yoord,$_GET['size'],$_GET['size'],$width,$height);
    		 imagedestroy($source);
     
             //if (preg_match("/.jpg$/i", $_GET['filename'])) ImageJPEG($target,null,90);
             //if (preg_match("/.gif$/i", $_GET['filename'])) ImageGIF($target,null,90);
             //if (preg_match("/.png$/i", $_GET['filename'])) ImageJPEG($target,null,90); // Using ImageJPEG on purpose
             ob_start(); // Start output buffering.
             header('Content-type: image/jpeg'); // We always render the thumbnail in JPEG even if the source is GIF or PNG.
    		 ImageJPEG($target,null,90);
             imagedestroy($target);
     
    		 $cachedImage = ob_get_contents(); // Get the buffer content.
             ob_end_flush();// End buffering
             $fd = fopen($thumbname, "w"); // Save buffer to disk
             if ($fd) { fwrite($fd,$cachedImage); fclose($fd); }
     
    }
     
    ?>
    Tout mon code se trouve dans le répertoire : /core/pages
    Les photos dans : /photos



    Voici le résultat : http://www.scf.asso.fr/index.php?page=galerie_photos

    Où ai-je merdé ?

    Merci pour votre aide.

    Eddy

  2. #2
    Membre confirmé
    Homme Profil pro
    Cobol sur Mainframe et Unix AIX
    Inscrit en
    Mars 2012
    Messages
    209
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Cobol sur Mainframe et Unix AIX

    Informations forums :
    Inscription : Mars 2012
    Messages : 209
    Par défaut
    j'ai l'impression (même la certitude) que le script createthumb.php n'est pas appelé

Discussions similaires

  1. Gallerie photos en flash
    Par nico93100 dans le forum Flash
    Réponses: 2
    Dernier message: 11/06/2007, 11h14
  2. Problème sur Gallerie Photo Flash du site
    Par brazilia28 dans le forum Flash
    Réponses: 4
    Dernier message: 09/02/2007, 19h08
  3. [Spip] Site avec gallerie photo intégrée
    Par Wookai dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 9
    Dernier message: 04/07/2006, 15h25
  4. Problème pour la Gallerie photo
    Par tabtab dans le forum Flash
    Réponses: 5
    Dernier message: 07/06/2006, 17h43
  5. [Js][pb gallerie photo]
    Par PyrroX dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 03/01/2006, 02h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo