Dotclear

Changeset 1989 for plugins/efiMetadatas


Ignore:
Timestamp:
12/18/09 01:47:08 (14 years ago)
Author:
JcDenis
Message:

efiMetadatas 0.2:

  • Added generic class to get readable meta
Location:
plugins/efiMetadatas
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/efiMetadatas/_define.php

    r1918 r1989  
    1717     /* Description*/         "Show metadatas of first image of an entry", 
    1818     /* Author */             "JC Denis", 
    19      /* Version */            '0.1', 
     19     /* Version */            '0.2', 
    2020     /* Permissions */        'admin' 
    2121); 
    22      /* date */          #20091129 
     22     /* date */          #20091218 
    2323?> 
  • plugins/efiMetadatas/_widgets.php

    r1918 r1989  
    6868          if ($w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id) return; 
    6969 
    70           # Path and url 
    71           $p_url = $core->blog->settings->public_url; 
    72           $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 
    73           $p_root = $core->blog->public_path; 
     70          # Content lookup 
     71          $text = $_ctx->posts->post_excerpt_xhtml.$_ctx->posts->post_content_xhtml; 
    7472 
    75           # Image pattern 
    76           $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 
    77           $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu',$pattern); 
    78  
    79           # Content lookup 
    80           $subject = $_ctx->posts->post_excerpt_xhtml.$_ctx->posts->post_content_xhtml; 
     73          # Find source image 
     74          $img = efiMetadatas::imgSource($core,$text,$w->thumbsize); 
    8175 
    8276          # No image 
    83           if (!preg_match_all($pattern,$subject,$m)) return; 
    84  
    85           $src = false; 
    86           $size = $w->thumbsize; 
    87           $alt = $metas = $thumb = ''; 
    88           $allowed_ext = array('.jpg','.JPG','.png','.PNG','.gif','.GIF'); 
    89  
    90           # Loop through images 
    91           foreach ($m[1] as $i => $img) 
    92           { 
    93                $src = false; 
    94                $info = path::info($img); 
    95                $base = $info['base']; 
    96                $ext = $info['extension']; 
    97  
    98                # Not original 
    99                if (preg_match('/^\.(.+)_(sq|t|s|m)$/',$base,$mbase)) 
    100                { 
    101                     $base = $mbase[1]; 
    102                } 
    103  
    104                # Full path 
    105                $f = $p_root.'/'.$info['dirname'].'/'.$base; 
    106  
    107                # Find extension 
    108                foreach($allowed_ext as $end) 
    109                { 
    110                     if (file_exists($f.$end)) 
    111                     { 
    112                          $src = $f.$end; 
    113                          break; 
    114                     } 
    115                } 
    116  
    117                # No file 
    118                if (!$src) continue; 
    119  
    120                # Find thumbnail 
    121                if (!empty($size)) 
    122                { 
    123                     $t = $p_root.'/'.$info['dirname'].'/.'.$base.'_'.$size.'.jpg'; 
    124                     if (file_exists($t)) 
    125                     { 
    126                          $thb = $p_url.(dirname($img) != '/' ? dirname($img) : '').'/.'.$base.'_'.$size.'.jpg'; 
    127                     } 
    128                } 
    129  
    130                # Find image description 
    131                if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) 
    132                { 
    133                     $alt = $malt[1]; 
    134                } 
    135                break; 
    136           } 
    137  
    138           # No image 
    139           if (!$src || !file_exists($src)) return; 
    140  
    141           # Image info         
    142           $metas_array = imageMeta::readMeta($src); 
     77          if (!$img['source']) return; 
    14378 
    14479          # List metas 
    145           foreach($metas_array as $k => $v) 
     80          $metas = efiMetadatas::imgMeta($core,$img['source']); 
     81 
     82          $content = ''; 
     83          foreach($metas as $k => $v) 
    14684          { 
    147                if (!$w->showmeta && !$v) continue; 
    148                $metas .= '<li><strong>'.__($k.':').'</strong><br />'.$v.'</li>'; 
     85               // keep empty meta if wanted 
     86               if (!$w->showmeta && empty($v[1])) continue; 
     87               $content .= '<li class="efi-'.$k.'"><strong>'.$v[0].':</strong><br />'.$v[1].'</li>'; 
    14988          } 
    15089 
    15190          # No meta 
    152           if (empty($metas)) return; 
    153  
     91          if (empty($content)) return; 
    15492 
    15593          # thumbnail 
    156           if (!empty($thb)) 
     94          if ($img['thumb']) 
    15795          { 
    15896               $thumb =  
    15997               '<div class="img-box">'.                 
    16098               '<div class="img-thumbnail">'. 
    161                '<img alt="'.$alt.'" src="'.$thb.'" />'. 
     99               '<img alt="'.$img['title'].'" src="'.$img['thumb'].'" />'. 
    162100               '</div>'. 
    163101               "</div>\n"; 
     
    168106          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). 
    169107          $thumb. 
    170           '<ul>'.$metas.'</ul>'. 
     108          '<ul>'.$content.'</ul>'. 
    171109          '</div>'; 
    172110     } 
  • plugins/efiMetadatas/locales/fr/main.lang.php

    r1918 r1989  
    22// Language: français  
    33// Module: efiMetadatas - 0.1 
    4 // Date: 2009-11-29 15:34:43  
     4// Date: 2009-12-18 00:28:47  
    55// Translated with dcTranslater - 1.3  
    66 
     
    2929$GLOBALS['__l10n']['Show empty metadatas'] = 'Afficher les métadonnées vides'; 
    3030 
     31#inc/class.efimetadatas.php:79 
     32$GLOBALS['__l10n']['Location'] = 'Lieu'; 
     33 
     34#inc/class.efimetadatas.php:81 
     35$GLOBALS['__l10n']['Manufacturer'] = 'Fabricant'; 
     36 
     37#inc/class.efimetadatas.php:82 
     38$GLOBALS['__l10n']['Model'] = 'Model'; 
     39 
     40#inc/class.efimetadatas.php:83 
     41$GLOBALS['__l10n']['Lens'] = 'Obgectif'; 
     42 
     43#inc/class.efimetadatas.php:84 
     44$GLOBALS['__l10n']['Program'] = 'Programme'; 
     45 
     46#inc/class.efimetadatas.php:85 
     47$GLOBALS['__l10n']['Speed'] = 'Vitesse'; 
     48 
     49#inc/class.efimetadatas.php:86 
     50$GLOBALS['__l10n']['Aperture'] = 'Ouverture'; 
     51 
     52#inc/class.efimetadatas.php:87 
     53$GLOBALS['__l10n']['ISO'] = 'ISO'; 
     54 
     55#inc/class.efimetadatas.php:88 
     56$GLOBALS['__l10n']['Focal'] = 'Focale'; 
     57 
     58#inc/class.efimetadatas.php:89 
     59$GLOBALS['__l10n']['Exposure Bias'] = 'Décalage d\'exposition'; 
     60 
     61#inc/class.efimetadatas.php:90 
     62$GLOBALS['__l10n']['Metering mode'] = 'Mode de mesure'; 
     63 
     64#inc/class.efimetadatas.php:94 
     65$GLOBALS['__l10n']['Not defined'] = 'Non défini'; 
     66 
     67#inc/class.efimetadatas.php:95 
     68$GLOBALS['__l10n']['Manual'] = 'Manuel'; 
     69 
     70#inc/class.efimetadatas.php:96 
     71$GLOBALS['__l10n']['Normal program'] = 'Normal'; 
     72 
     73#inc/class.efimetadatas.php:97 
     74$GLOBALS['__l10n']['Aperture priority'] = 'Priorité à l\'ouverture'; 
     75 
     76#inc/class.efimetadatas.php:98 
     77$GLOBALS['__l10n']['Shutter priority'] = 'Priorité à la vitesse'; 
     78 
     79#inc/class.efimetadatas.php:99 
     80$GLOBALS['__l10n']['Creative program'] = 'Création'; 
     81 
     82#inc/class.efimetadatas.php:100 
     83$GLOBALS['__l10n']['Action program'] = 'Action'; 
     84 
     85#inc/class.efimetadatas.php:101 
     86$GLOBALS['__l10n']['Portait mode'] = 'Portrait'; 
     87 
     88#inc/class.efimetadatas.php:102 
     89$GLOBALS['__l10n']['Landscape mode'] = 'Paysage'; 
     90 
     91#inc/class.efimetadatas.php:106 
     92$GLOBALS['__l10n']['Unknow'] = 'Inconnu'; 
     93 
     94#inc/class.efimetadatas.php:107 
     95$GLOBALS['__l10n']['Average'] = 'Moyenne'; 
     96 
     97#inc/class.efimetadatas.php:108 
     98$GLOBALS['__l10n']['Center-weighted average'] = 'Centrale pondèrée'; 
     99 
     100#inc/class.efimetadatas.php:109 
     101$GLOBALS['__l10n']['Spot'] = 'Spot'; 
     102 
     103#inc/class.efimetadatas.php:110 
     104$GLOBALS['__l10n']['Multi spot'] = 'Multi spot'; 
     105 
     106#inc/class.efimetadatas.php:111 
     107$GLOBALS['__l10n']['Pattern'] = 'Multizone'; 
     108 
     109#inc/class.efimetadatas.php:112 
     110$GLOBALS['__l10n']['Partial'] = 'Partielle'; 
     111 
     112#inc/class.efimetadatas.php:113 
     113$GLOBALS['__l10n']['Other'] = 'Autre'; 
     114 
    31115?> 
  • plugins/efiMetadatas/locales/fr/main.po

    r1918 r1989  
    11# Language: français 
    22# Module: efiMetadatas - 0.1 
    3 # Date: 2009-11-29 15:34:43 
     3# Date: 2009-12-18 00:28:47 
    44# Translated with translater 1.3 
    55 
     
    99"Project-Id-Version: efiMetadatas 0.1\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2009-11-29T15:34:43+00:00\n" 
     11"PO-Revision-Date: 2009-12-18T00:28:47+00:00\n" 
    1212"Last-Translator: JC Denis\n" 
    1313"Language-Team: \n" 
     
    4747msgstr "Afficher les métadonnées vides" 
    4848 
     49#: inc/class.efimetadatas.php:79 
     50msgid "Location" 
     51msgstr "Lieu" 
     52 
     53#: inc/class.efimetadatas.php:81 
     54msgid "Manufacturer" 
     55msgstr "Fabricant" 
     56 
     57#: inc/class.efimetadatas.php:82 
     58msgid "Model" 
     59msgstr "Model" 
     60 
     61#: inc/class.efimetadatas.php:83 
     62msgid "Lens" 
     63msgstr "Obgectif" 
     64 
     65#: inc/class.efimetadatas.php:84 
     66msgid "Program" 
     67msgstr "Programme" 
     68 
     69#: inc/class.efimetadatas.php:85 
     70msgid "Speed" 
     71msgstr "Vitesse" 
     72 
     73#: inc/class.efimetadatas.php:86 
     74msgid "Aperture" 
     75msgstr "Ouverture" 
     76 
     77#: inc/class.efimetadatas.php:87 
     78msgid "ISO" 
     79msgstr "ISO" 
     80 
     81#: inc/class.efimetadatas.php:88 
     82msgid "Focal" 
     83msgstr "Focale" 
     84 
     85#: inc/class.efimetadatas.php:89 
     86msgid "Exposure Bias" 
     87msgstr "Décalage d'exposition" 
     88 
     89#: inc/class.efimetadatas.php:90 
     90msgid "Metering mode" 
     91msgstr "Mode de mesure" 
     92 
     93#: inc/class.efimetadatas.php:94 
     94msgid "Not defined" 
     95msgstr "Non défini" 
     96 
     97#: inc/class.efimetadatas.php:95 
     98msgid "Manual" 
     99msgstr "Manuel" 
     100 
     101#: inc/class.efimetadatas.php:96 
     102msgid "Normal program" 
     103msgstr "Normal" 
     104 
     105#: inc/class.efimetadatas.php:97 
     106msgid "Aperture priority" 
     107msgstr "Priorité à l'ouverture" 
     108 
     109#: inc/class.efimetadatas.php:98 
     110msgid "Shutter priority" 
     111msgstr "Priorité à la vitesse" 
     112 
     113#: inc/class.efimetadatas.php:99 
     114msgid "Creative program" 
     115msgstr "Création" 
     116 
     117#: inc/class.efimetadatas.php:100 
     118msgid "Action program" 
     119msgstr "Action" 
     120 
     121#: inc/class.efimetadatas.php:101 
     122msgid "Portait mode" 
     123msgstr "Portrait" 
     124 
     125#: inc/class.efimetadatas.php:102 
     126msgid "Landscape mode" 
     127msgstr "Paysage" 
     128 
     129#: inc/class.efimetadatas.php:106 
     130msgid "Unknow" 
     131msgstr "Inconnu" 
     132 
     133#: inc/class.efimetadatas.php:107 
     134msgid "Average" 
     135msgstr "Moyenne" 
     136 
     137#: inc/class.efimetadatas.php:108 
     138msgid "Center-weighted average" 
     139msgstr "Centrale pondèrée" 
     140 
     141#: inc/class.efimetadatas.php:109 
     142msgid "Spot" 
     143msgstr "Spot" 
     144 
     145#: inc/class.efimetadatas.php:110 
     146msgid "Multi spot" 
     147msgstr "Multi spot" 
     148 
     149#: inc/class.efimetadatas.php:111 
     150msgid "Pattern" 
     151msgstr "Multizone" 
     152 
     153#: inc/class.efimetadatas.php:112 
     154msgid "Partial" 
     155msgstr "Partielle" 
     156 
     157#: inc/class.efimetadatas.php:113 
     158msgid "Other" 
     159msgstr "Autre" 
     160 
Note: See TracChangeset for help on using the changeset viewer.

Sites map