Warning: UPDATE command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_cache' query: UPDATE drupal_cache SET data = 'a:448:{s:13:\"theme_default\";s:7:\"garland\";s:13:\"filter_html_1\";i:1;s:18:\"node_options_forum\";a:1:{i:0;s:6:\"status\";}s:17:\"menu_primary_menu\";i:2;s:19:\"menu_secondary_menu\";i:2;s:15:\"install_profile\";s:7:\"default\";s:17:\"node_options_page\";a:1:{i:0;s:6:\"status\";}s:12:\"comment_page\";s:1:\"0\";s:18:\"drupal_private_key\";s:64:\"b4e640288de05f522bbe6b032bdd5e965244625713cbf8cf2021d99f2fe3072a\";s:19:\"file_directory_temp\";s:9:\"files/tmp\";s:19:\"file_directory_path\";s:5:\"files\";s:14:\"file_downloads\";s:1:\"1\";s:21:\"date_default_timezone\";s:4:\"7200\";s:22:\"configurable_timezones\";s:1:\" in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174) in /home/michelon/www/olivier/blog/includes/bootstrap.inc on line 569

Warning: Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174) in /home/michelon/www/olivier/blog/includes/bootstrap.inc on line 570

Warning: Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174) in /home/michelon/www/olivier/blog/includes/bootstrap.inc on line 571

Warning: Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174) in /home/michelon/www/olivier/blog/includes/bootstrap.inc on line 572

Warning: INSERT command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_watchdog' query: INSERT INTO drupal_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174)</em> in <em>/home/michelon/www/olivier/blog/includes/common.inc</em> on line <em>141</em>.', 2, '', 'http://olivier.michelon.me/blog/?q=article/drupal-ajouter-le-module-lightbox2-une-gallerie-dimages-creee-avec-le-module-image', '', '23.20.147.6', 1495702303) in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174

Warning: INSERT command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_watchdog' query: INSERT INTO drupal_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>UPDATE command denied to user &amp;#039;michelon01&amp;#039;@&amp;#039;10.0.126.106&amp;#039; for table &amp;#039;drupal_cache_browscap&amp;#039;\nquery: UPDATE drupal_cache_browscap SET data = &amp;#039;O:8:\\&amp;quot;stdClass\\&amp;quot;:2:{s:9:\\&amp;quot;useragent\\&amp;quot;;s:1:\\&amp;quot;%\\&amp;quot;;s:4:\\&amp;quot;data\\&amp;quot;;s:609:\\&amp;quot;a:25:{s:7:\\&amp;quot;browser\\&amp;quot;;s:15:\\&amp;quot;Default Browser\\&amp;quot;;s:7:\\&amp;quot;version\\&amp;quot;;s:1:\\&amp;quot;0\\&amp;quot;;s:8:\\&amp;quot;majorver\\&amp;quot;;s:1:\\&amp;quot;0\\&amp;quot;;s:8:\\&amp;quot;minorver\\&amp;quot;;s:1:\\&a in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174
Drupal : ajouter le module Lightbox2 à une gallerie d'images créée avec le module Image | MICHBlog

Drupal : ajouter le module Lightbox2 à une gallerie d'images créée avec le module Image

  • warning: Cannot modify header information - headers already sent by (output started at /home/michelon/www/olivier/blog/includes/database.mysql.inc:174) in /home/michelon/www/olivier/blog/includes/common.inc on line 141.
  • user warning: UPDATE command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_cache_browscap' query: UPDATE drupal_cache_browscap SET data = 'O:8:\"stdClass\":2:{s:9:\"useragent\";s:1:\"%\";s:4:\"data\";s:609:\"a:25:{s:7:\"browser\";s:15:\"Default Browser\";s:7:\"version\";s:1:\"0\";s:8:\"majorver\";s:1:\"0\";s:8:\"minorver\";s:1:\"0\";s:8:\"platform\";s:7:\"unknown\";s:5:\"alpha\";s:0:\"\";s:4:\"beta\";s:0:\"\";s:5:\"win16\";s:0:\"\";s:5:\"win32\";s:0:\"\";s:5:\"win64\";s:0:\"\";s:6:\"frames\";s:0:\"\";s:7:\"iframes\";s:0:\"\";s:6:\"tables\";s:0:\"\";s:7:\"cookies\";s:0:\"\";s:16:\"backgroundsounds\";s:0:\"\";s:10:\"javascript\";s:0:\"\";s:8:\"vbscript\";s:0:\"\";s:11:\"javaapplets\";s:0:\"\";s:15:\"activexcontrols\";s:0:\"\";s:8:\"isbanned\";s:0:\"\";s:14:\"ismobiledevice\";s:0:\"\";s:19:\"issyndicationreader\";s:0:\"\";s:7:\"crawler\";s:0:\"\";s:10:\"cssversion\";s:1:\"0\";s:10:\"aolversion\";s:1:\"0\";}\";}', created = 1495702303, expire = 0, headers = '' WHERE cid = 'CCBot/2.0 (http://commoncrawl.org/faq/)' in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174.

J'en profite pour vous signaler une nouveauté sur mon blog : le MICHFlickr en haut à droite!!

Lightbox2 est à priori un super module compatible avec tous les modules d'image sur Drupal! Il doit, toujours à priori, automatiquement modifier les liens existants vers des images avec les paramètres qui vont bien pour qu'elles puissent s'afficher dans le viewer JS Lightbox2.

En pratique, rien du tout!

Je possède plusieurs galeries d'images créées avec le module Image, et Lightbox2 ne m'a pas changé les liens de ces galeries! Aidé par ici, j'ai alors entrepris de développer une page compatible avec Lightbox2 à l'image de celle affichant les galeries (/?q=image).

 Pour votre information, voici un extrait de ma Drupal config:

Cette configuration doit probablement planter avec l'outil "Automatic image gandling" de Lightbox2.

Je vous communique le code, parce qu'à la vue des premiers résultats Google, ça peut intéresser du monde!

<style type="text/css" media="all">
    ul.galleries{
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.galleries li.subgalleries {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:#EEEEEE none repeat scroll 0 0;
        border:1px solid #CCCCCC;
        margin:1em 0;
        padding:1em;
        position:relative;
    }
    ul.images {
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.images li {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:transparent none repeat scroll 0 0;
        float:left;
        margin:1em 2em 1em 0;
        padding:0;
    }
    ul.images li h3{
        font-size:1em;
    }
</style>
<ul class="galleries">
<?php
$result = db_query ("SELECT td.tid AS tid, td.name AS name, td.description AS description FROM {term_data} td");
while ($img = db_fetch_object($result)) {
    echo "<li class=\"subgalleries clear-block\">";
    echo "<h3>".$img->name."</h3>";
    echo "<div class=\"description\"><p>".$img->description."</p></div>";
    echo "<ul class=\"images clear-block\">";
    $gallery_tid=$img->tid;
    $subresult = db_query ("SELECT n.title AS title, f1.filepath AS originalpath, f2.filepath AS thumbpath FROM {files} f1, {files} f2, {node} n, {image} i, {image} i2, {term_node} tn WHERE tn.tid=%d AND i.nid=tn.nid  AND i.image_size='_original' AND i2.image_size='thumbnail' AND n.nid=tn.nid AND f1.fid=i.fid AND f2.fid=i2.fid AND i.nid=i2.nid", $gallery_tid);
    while ($subimg = db_fetch_object($subresult)) {
        echo "<li style='width : 100px;'>";
        echo "    <a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title."\"><img src=\"/blog/".$subimg->thumbpath."\" width=\"100\" title=\"".$subimg->title."\"/></a>";
        echo "    <h3><a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title."\">".$subimg->title."</a></h3>";
        echo "</li>";
    }
    echo "</ul>";
    echo "</li>";
}
?>
</ul>

Ce code est à insérer en PHP code dans une page par exemple.

EDIT 1 : Affichage des paramètres EXIF

<style type="text/css" media="all">
   ul.galleries{
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.galleries li.subgalleries {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:#EEEEEE none repeat scroll 0 0;
        border:1px solid #CCCCCC;
        margin:1em 0;
        padding:1em;
        position:relative;
    }
    ul.images {
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.images li {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:transparent none repeat scroll 0 0;
        float:left;
        margin:1em 2em 1em 0;
        padding:0;
    }
    ul.images li h3{
        font-size:1em;
    }
</style>
<ul class="galleries">
<?php
$result = db_query ("SELECT td.tid AS tid, td.name AS name, td.description AS description FROM {term_data} td");
while ($img = db_fetch_object($result)) {
    echo "<li class=\"subgalleries clear-block\">";
    echo "<h3>".$img->name."</h3>";
    echo "<div class=\"description\"><p>".$img->description."</p></div>";
    echo "<ul class=\"images clear-block\">";
    $gallery_tid=$img->tid;
    $subresult = db_query ("SELECT n.title AS title, f1.filepath AS originalpath, f2.filepath AS thumbpath FROM {files} f1, {files} f2, {node} n, {image} i, {image} i2, {term_node} tn WHERE tn.tid=%d AND i.nid=tn.nid  AND i.image_size='_original' AND i2.image_size='thumbnail' AND n.nid=tn.nid AND f1.fid=i.fid AND f2.fid=i2.fid AND i.nid=i2.nid", $gallery_tid);
    while ($subimg = db_fetch_object($subresult)) {
        $res_exif = "";
        if(in_array(strtolower(end(explode('.', $_SERVER['DOCUMENT_ROOT']."/blog/".$subimg->originalpath))), array('jpg', 'jpeg', 'tif', 'tiff'))){
            if($exif = exif_read_data($_SERVER['DOCUMENT_ROOT']."/blog/".$subimg->originalpath, EXIF, true)){
                $res_exif = "<br />";
                $exif_tab = Array();
                foreach ($exif as $key => $section){
                    foreach ($section as $name => $value){
                        $exif_tab[$name] .= $value;
                    }
                }
                if($exif_tab['FocalLength']){
                    $focale = round($exif_tab['FocalLength'], 0)/10;
                    $focale = $focale." mm";
                }
                if($exif_tab['Make'])
                    $marque = $exif_tab['Make'];
                if($exif_tab['Model'])
                    $modele = $exif_tab['Model'];
                if($exif_tab['ExposureTime'])
                    $vit_obt = $exif_tab['ExposureTime']." s";
                if($exif_tab['ISOSpeedRatings'])
                    $iso = $exif_tab['ISOSpeedRatings'];
                if($exif_tab['ApertureFNumber'])
                    $ouverture = $exif_tab['ApertureFNumber'];
                $res_exif .= "<span style='font-size:7px'>Focale: <i>".$focale."</i> | Ouverture <i>".$ouverture."</i> | Vitesse d'obturation: <i>".$vit_obt."</i> | ISO: <i>".$iso."</i></span>";
            }
        }
        echo "<li style='width : 100px;'>";
        echo "    <a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title.$res_exif."\"><img src=\"/blog/".$subimg->thumbpath."\" width=\"100\" title=\"".$subimg->title."\"/></a>";
        echo "    <h3><a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title.$res_exif."\">".$subimg->title."</a></h3>";
        echo "</li>";
    }
    echo "</ul>";
    echo "</li>";
}
?>
</ul>

EDIT 2 : Pagination

<style type="text/css" media="all">
    ul.galleries{
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.galleries li.subgalleries {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:#EEEEEE none repeat scroll 0 0;
        border:1px solid #CCCCCC;
        margin:1em 0;
        padding:1em;
        position:relative;
    }
    ul.images {
        list-style-type:none;
        margin:0;
        padding:0;
    }
    ul.images li {
        -moz-background-clip:border;
        -moz-background-inline-policy:continuous;
        -moz-background-origin:padding;
        background:transparent none repeat scroll 0 0;
        float:left;
        margin:1em 2em 1em 0;
        padding:0;
        width : 100px;
        height: 166px;
    }
    ul.images li h3{
        font-size:1em;
    }
</style>
<ul class="galleries">
<?php
$sql = "SELECT td.tid AS tid, td.name AS name, td.description AS description FROM {term_data} td ORDER BY td.tid DESC";
$result = pager_query(db_rewrite_sql($sql), 3);
while ($img = db_fetch_object($result)) {
    print "<li class=\"subgalleries clear-block\">";
    print "<h3>".$img->name."</h3>";
    print "<div class=\"description\"><p>".$img->description."</p></div>";
    print "<ul class=\"images clear-block\">";
    $gallery_tid=$img->tid;
    $subresult = db_query ("SELECT n.title AS title, f1.filepath AS originalpath, f2.filepath AS thumbpath FROM {files} f1, {files} f2, {node} n, {image} i, {image} i2, {term_node} tn WHERE tn.tid=%d AND i.nid=tn.nid  AND i.image_size='_original' AND i2.image_size='thumbnail' AND n.nid=tn.nid AND f1.fid=i.fid AND f2.fid=i2.fid AND i.nid=i2.nid", $gallery_tid);
    while ($subimg = db_fetch_object($subresult)) {
        $res_exif = "";
        if(in_array(strtolower(end(explode('.', $_SERVER['DOCUMENT_ROOT']."/blog/".$subimg->originalpath))), array('jpg', 'jpeg', 'tif', 'tiff'))){ // Si fichier Jpeg ou Tiff
            if($exif = exif_read_data($_SERVER['DOCUMENT_ROOT']."/blog/".$subimg->originalpath, EXIF, true)){ // Si le fichier $img contient des infos Exif
                $res_exif = "<br />";
                $exif_tab = Array();
                foreach ($exif as $key => $section){ // On parcourt la première partie du tableau multidimensionnel
                    foreach ($section as $name => $value){ // On parcourt la seconde partie
                        $exif_tab[$name] .= $value; // Récupération des valeurs dans le tableau $exif_tab
                    }
                }
                if($exif_tab['FocalLength']){ // Si les données de la distance focale existent
                    $focale = round($exif_tab['FocalLength'], 0)/10; // j'arrondis la valeur
                    $focale = $focale." mm"; // Je rajoute l'unité millimètre
                }
                if($exif_tab['Make']) // Marque de l'appareil
                    $marque = $exif_tab['Make'];
                if($exif_tab['Model'])// Modèle de l'appareil
                    $modele = $exif_tab['Model'];
                if($exif_tab['ExposureTime'])// Vitesse d'obturation
                    $vit_obt = $exif_tab['ExposureTime']." s";
                if($exif_tab['ISOSpeedRatings']) // Valeur iso
                    $iso = $exif_tab['ISOSpeedRatings'];
                if($exif_tab['ApertureFNumber'])//valeur ouverture
                    $ouverture = $exif_tab['ApertureFNumber'];
                $res_exif .= "<span style='font-size:7px'>Focale: <i>".$focale."</i> | Ouverture <i>".$ouverture."</i> | Vitesse d'obturation: <i>".$vit_obt."</i> | ISO: <i>".$iso."</i></span>";
            }
        }
        print "<li>";
        print "    <a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title.$res_exif."\"><img src=\"/blog/".$subimg->thumbpath."\" width=\"100\" title=\"".$subimg->title."\"/></a>";
        print "    <h3><a href=\"/blog/".$subimg->originalpath."\" rel=\"lightshow[".$img->name."]\" title=\"".$subimg->title.$res_exif."\">".$subimg->title."</a></h3>";
        print "</li>";
    }
    print "</ul>";
    print "</li>";
}
?>
</ul>
<?php
    print theme('pager', NULL, 5);
?>

Commentaires

Poster un nouveau commentaire

Le contenu de ce champ ne sera pas montré publiquement.
Image CAPTCHA
Entrez les caractères affichés sur l'image sans espaces.
Syndiquer le contenu

Warning: INSERT command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_watchdog' query: INSERT INTO drupal_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>UPDATE command denied to user &amp;#039;michelon01&amp;#039;@&amp;#039;10.0.126.106&amp;#039; for table &amp;#039;drupal_node_counter&amp;#039;\nquery: UPDATE drupal_node_counter SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = 1495702303 WHERE nid = 72</em> dans <em>/home/michelon/www/olivier/blog/includes/database.mysql.inc</em> à la ligne <em>174</em>.', 2, '', 'http://olivier.michelon.me/blog/?q=article/drupal-ajouter-le-module-lightbox2-une-gallerie-dimages-creee-avec-le-module-image', '', '23.20.147.6', 1495702303) in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174

Warning: INSERT command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_watchdog' query: INSERT INTO drupal_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>INSERT command denied to user &amp;#039;michelon01&amp;#039;@&amp;#039;10.0.126.106&amp;#039; for table &amp;#039;drupal_accesslog&amp;#039;\nquery: INSERT INTO drupal_accesslog (title, path, url, hostname, uid, sid, timer, timestamp) values(&amp;#039;Drupal : ajouter le module Lightbox2 à une gallerie d&amp;amp;#039;images créée avec le module Image&amp;#039;, &amp;#039;node/72&amp;#039;, &amp;#039;&amp;#039;, &amp;#039;23.20.147.6&amp;#039;, 0, &amp;#039;134839b631f8fecac54f23ce07c7afc4&amp;#039;, 148, 1495702303)</em> dans <em>/home/michelon/www/olivier/blog/includes/database.mysql.inc</em> à la ligne <em>174</em>.', 2, '', in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174

Warning: INSERT command denied to user 'michelon01'@'10.0.126.106' for table 'drupal_watchdog' query: INSERT INTO drupal_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>UPDATE command denied to user &amp;#039;michelon01&amp;#039;@&amp;#039;10.0.126.106&amp;#039; for table &amp;#039;drupal_sessions&amp;#039;\nquery: UPDATE drupal_sessions SET uid = 0, cache = 0, hostname = &amp;#039;23.20.147.6&amp;#039;, session = &amp;#039;image_captcha|a:1:{i:246517343;s:5:\\&amp;quot;LGirt\\&amp;quot;;}captcha|a:1:{s:12:\\&amp;quot;comment_form\\&amp;quot;;a:2:{s:32:\\&amp;quot;550e67af46741337dec8f5e08ad7ae7f\\&amp;quot;;s:5:\\&amp;quot;lgirt\\&amp;quot;;s:7:\\&amp;quot;success\\&amp;quot;;b:0;}}messages|a:1:{s:5:\\&amp;quot;error\\&amp;quot;;a:2:{i:0;s:339:\\&amp;quot;user warning: UPDATE command denied to user &amp;amp;#039;mich in /home/michelon/www/olivier/blog/includes/database.mysql.inc on line 174