Changeset 2304
- Timestamp:
- 06/06/10 00:50:39 (13 years ago)
- Location:
- plugins/efiMetadatas
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/efiMetadatas/_admin.php
r1918 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # -
plugins/efiMetadatas/_define.php
r1989 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 17 17 /* Description*/ "Show metadatas of first image of an entry", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 2',19 /* Version */ '0.3', 20 20 /* Permissions */ 'admin' 21 21 ); 22 /* date */ #20 09121822 /* date */ #20100605 23 23 ?> -
plugins/efiMetadatas/_prepend.php
r1989 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # -
plugins/efiMetadatas/_public.php
r1918 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # -
plugins/efiMetadatas/_widgets.php
r1989 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 20 20 { 21 21 global $core; 22 22 23 23 $categories_combo = array('-' => '', __('Uncategorized') => 'null'); 24 24 $categories = $core->blog->getCategories(); … … 28 28 $categories_combo[$cat_title] = $categories->cat_id; 29 29 } 30 30 31 31 $thumbnail_combo = array( 32 32 '-' => '', … … 36 36 __('medium') => 'm' 37 37 ); 38 38 39 39 $w->create('efim', 40 40 __('Entry first image metadatas'),array('efiMetadatasWidget','publicEFIM') … … 53 53 ); 54 54 } 55 55 56 56 public static function publicEFIM($w) 57 57 { 58 58 global $core, $_ctx; 59 59 60 60 # Not in post context 61 61 if (!$_ctx->exists('posts') || !$_ctx->posts->post_id) return; 62 62 63 63 # Not supported post type 64 64 if (!in_array($_ctx->posts->post_type,array('post','gal','galitem'))) return ''; 65 65 66 66 # Category limit 67 67 if ($w->category == 'null' && $_ctx->posts->cat_id !== null) return; 68 68 if ($w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id) return; 69 69 70 70 # Content lookup 71 71 $text = $_ctx->posts->post_excerpt_xhtml.$_ctx->posts->post_content_xhtml; 72 72 73 73 # Find source image 74 74 $img = efiMetadatas::imgSource($core,$text,$w->thumbsize); 75 75 76 76 # No image 77 77 if (!$img['source']) return; 78 78 79 79 # List metas 80 80 $metas = efiMetadatas::imgMeta($core,$img['source']); 81 81 82 82 $content = ''; 83 83 foreach($metas as $k => $v) … … 87 87 $content .= '<li class="efi-'.$k.'"><strong>'.$v[0].':</strong><br />'.$v[1].'</li>'; 88 88 } 89 89 90 90 # No meta 91 91 if (empty($content)) return; 92 92 93 93 # thumbnail 94 94 if ($img['thumb']) … … 101 101 "</div>\n"; 102 102 } 103 103 104 104 return 105 105 '<div class="entryFirstImageMetas">'. -
plugins/efiMetadatas/inc/class.efimetadatas.php
r1989 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 11 11 # -- END LICENSE BLOCK ------------------------------------ 12 12 13 14 13 class efiMetadatas 15 14 { … … 17 16 { 18 17 # Path and url 19 $p_url = $core->blog->settings-> public_url;18 $p_url = $core->blog->settings->system->public_url; 20 19 $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 21 20 $p_root = $core->blog->public_path; 22 21 23 22 # Image pattern 24 23 $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 25 24 $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu',$pattern); 26 25 27 26 # No image 28 27 if (!preg_match_all($pattern,$subject,$m)) return; 29 28 30 29 $src = $thb = $alt = false; 31 30 $alt = $metas = $thumb = ''; 32 31 $allowed_ext = array('.jpg','.JPG','.png','.PNG','.gif','.GIF'); 33 32 34 33 # Loop through images 35 34 foreach ($m[1] as $i => $img) … … 39 38 $base = $info['base']; 40 39 $ext = $info['extension']; 41 40 42 41 # Not original 43 42 if (preg_match('/^\.(.+)_(sq|t|s|m)$/',$base,$mbase)) … … 45 44 $base = $mbase[1]; 46 45 } 47 46 48 47 # Full path 49 48 $f = $p_root.'/'.$info['dirname'].'/'.$base; 50 49 51 50 # Find extension 52 51 foreach($allowed_ext as $end) … … 58 57 } 59 58 } 60 59 61 60 # No file 62 61 if (!$src) continue; 63 62 64 63 # Find thumbnail 65 64 if (!empty($size)) … … 71 70 } 72 71 } 73 72 74 73 # Find image description 75 74 if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) … … 82 81 return array('source' => $src, 'thumb' => $thb, 'title' => $alt); 83 82 } 84 83 85 84 public static function imgMeta($core,$src) 86 85 { … … 101 100 'MeteringMode' => array(__('Metering mode'),'') 102 101 ); 103 102 104 103 $exp_prog = array( 105 104 0 => __('Not defined'), … … 113 112 8 => __('Landscape mode') 114 113 ); 115 114 116 115 $met_mod = array( 117 116 0 => __('Unknow'), … … 124 123 7 => __('Other') 125 124 ); 126 125 127 126 if (!$src || !file_exists($src)) return $metas; 128 127 129 128 $m = imageMeta::readMeta($src); 130 129 131 130 # Title 132 131 if (!empty($m['Title'])) … … 134 133 $metas['Title'][1] = html::escapeHTML($m['Title']); 135 134 } 136 135 137 136 # Description 138 137 if (!empty($m['Description'])) … … 143 142 } 144 143 } 145 144 146 145 # Location 147 146 if (!empty($m['City'])) … … 161 160 if (!empty($m['DateTimeOriginal'])) 162 161 { 163 $dt_ft = $core->blog->settings-> date_format.', '.$core->blog->settings->time_format;164 $dt_tz = $core->blog->settings-> blog_timezone;162 $dt_ft = $core->blog->settings->system->date_format.', '.$core->blog->settings->system->time_format; 163 $dt_tz = $core->blog->settings->system->blog_timezone; 165 164 $metas['DateTimeOriginal'][1] = dt::dt2str($dt_ft,$m['DateTimeOriginal'],$dt_tz); 166 165 } 167 166 168 167 # Make 169 168 if (isset($m['Make'])) … … 171 170 $metas['Make'][1] = html::escapeHTML($m['Make']); 172 171 } 173 172 174 173 # Model 175 174 if (isset($m['Model'])) … … 177 176 $metas['Model'][1] = html::escapeHTML($m['Model']); 178 177 } 179 178 180 179 # Lens 181 180 if (isset($m['Lens'])) … … 190 189 $exp_prog[$m['ExposureProgram']] : $m['ExposureProgram']; 191 190 } 192 191 193 192 # Exposure 194 193 if (!empty($m['Exposure'])) … … 196 195 $metas['Exposure'][1] = $m['Exposure'].'s'; 197 196 } 198 197 199 198 # FNumber 200 199 if (!empty($m['FNumber'])) … … 203 202 $metas['FNumber'][1] = $ap ? 'f/'.( $ap[0] / $ap[1]) : $m['FNumber']; 204 203 } 205 204 206 205 # ISOSpeedRatings 207 206 if (!empty($m['ISOSpeedRatings'])) … … 209 208 $metas['ISOSpeedRatings'][1] = $m['ISOSpeedRatings']; 210 209 } 211 210 212 211 # FocalLength 213 212 if (!empty($m['FocalLength'])) … … 216 215 $metas['FocalLength'][1] = $fl ? $fl[0]/$fl[1].'mm' : $m['FocalLength']; 217 216 } 218 217 219 218 # ExposureBiasValue 220 219 if (isset($m['ExposureBiasValue'])) … … 222 221 $metas['ExposureBiasValue'][1] = $m['ExposureBiasValue']; 223 222 } 224 223 225 224 # MeteringMode 226 225 if (isset($m['MeteringMode'])) … … 229 228 $exp_prog[$m['MeteringMode']] : $m['MeteringMode']; 230 229 } 231 230 232 231 return $metas; 233 232 } -
plugins/efiMetadatas/release.txt
r1989 r2304 1 0.3 20100605 2 * Switched to DC 2.2 3 1 4 0.2 20091218 2 5 * Added generic class to get readable meta
Note: See TracChangeset
for help on using the changeset viewer.