Changeset 4698 for extensions/AMetaData/JpegMetaData/test
- Timestamp:
- Jan 17, 2010, 7:05:35 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/JpegMetaData/test/index.php
r4686 r4698 1 1 <?php 2 /* 3 * --:: JPEG MetaDatas ::------------------------------------------------------- 4 * 5 * Author : Grum 6 * email : grum at piwigo.org 7 * website : http://photos.grum.fr 8 * 9 * << May the Little SpaceFrog be with you ! >> 10 * 11 * 12 * +-----------------------------------------------------------------------+ 13 * | JpegMetaData - a PHP based Jpeg Metadata manager | 14 * +-----------------------------------------------------------------------+ 15 * | Copyright(C) 2010 Grum - http://www.grum.fr | 16 * +-----------------------------------------------------------------------+ 17 * | This program is free software; you can redistribute it and/or modify | 18 * | it under the terms of the GNU General Public License as published by | 19 * | the Free Software Foundation | 20 * | | 21 * | This program is distributed in the hope that it will be useful, but | 22 * | WITHOUT ANY WARRANTY; without even the implied warranty of | 23 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 24 * | General Public License for more details. | 25 * | | 26 * | You should have received a copy of the GNU General Public License | 27 * | along with this program; if not, write to the Free Software | 28 * | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 29 * | USA. | 30 * +-----------------------------------------------------------------------+ 31 * 32 * 33 * ----------------------------------------------------------------------------- 34 * 35 * This file is used to test the capabilities of the JpegMetaData classes 36 * 37 * ----------------------------------------------------------------------------- 38 * 39 * 40 * ----------------------------------------------------------------------------- 41 */ 42 2 43 ini_set('error_reporting', E_ALL | E_STRICT); 3 44 ini_set('display_errors', true); … … 13 54 require_once(JPEG_METADATA_DIR."TagDefinitions/XmpTags.class.php"); 14 55 15 echo " 16 <html> 17 <header> 18 <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> 19 </header> 20 <body> 21 -- Tests --<br> 22 "; 23 24 echo "<hr>-- Images --<br>"; 25 26 $d = scandir(dirname(__FILE__)); 27 28 foreach($d as $key => $file) 29 { 30 if(preg_match("/.*\.(jpg|jpeg)/i",$file)) 31 echo "[<a href='?file=".$file."'>$file</a>] "; 32 } 33 34 35 echo "<hr>-- Resultat --<br>"; 36 37 38 function dump_xml($xml) 39 { 40 $color=Array( 41 0 => "000000", 42 1 => "ff0000", 43 2 => "0000ff", 44 3 => "008000", 45 4 => "800000", 46 5 => "000080", 47 6 => "008080", 48 7 => "808000", 49 8 => "800080", 50 9 => "808080"); 51 52 $parser = xml_parser_create(); 53 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); 54 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 55 xml_parse_into_struct($parser, $xml, $values, $tags); 56 xml_parser_free($parser); 57 58 foreach($values as $key => $val) 59 { 60 switch($val['type']) 61 { 62 case "open": 63 echo "<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."".$val['tag']."</span>"; 64 if(array_key_exists("attributes", $val)) 65 foreach($val['attributes'] as $key2 => $val2) 56 57 /* 58 * functions 59 * 60 */ 61 62 function dump_xml($xml) 63 { 64 $returned=""; 65 66 $color=Array( 67 0 => "000000", 68 1 => "ff0000", 69 2 => "0000ff", 70 3 => "008000", 71 4 => "800000", 72 5 => "000080", 73 6 => "008080", 74 7 => "808000", 75 8 => "800080", 76 9 => "808080"); 77 78 $parser = xml_parser_create(); 79 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); 80 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 81 xml_parse_into_struct($parser, $xml, $values, $tags); 82 xml_parser_free($parser); 83 84 foreach($values as $key => $val) 85 { 86 switch($val['type']) 87 { 88 case "open": 89 $returned.="<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."".$val['tag']."</span>"; 90 if(array_key_exists("attributes", $val)) 91 foreach($val['attributes'] as $key2 => $val2) 92 { 93 $returned.="<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>"; 94 } 95 break; 96 case "close": 97 $returned.="<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."/".$val['tag']."</span>"; 98 if(array_key_exists("attributes", $val)) 99 foreach($val['attributes'] as $key2 => $val2) 100 { 101 $returned.="<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>"; 102 } 103 break; 104 case "complete": 105 $returned.="<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."/".$val['tag']."</span>"; 106 if(array_key_exists("attributes", $val)) 107 foreach($val['attributes'] as $key2 => $val2) 108 { 109 $returned.="<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>"; 110 } 111 break; 112 } 113 if(array_key_exists('value', $val)) 114 $returned.=" <span style='color:#ff00ff;'>".$val['value']."</span>"; 115 $returned.="<br>"; 116 117 } 118 119 return($returned); 120 } 121 122 123 function dump_ifd($key2, $val2) 124 { 125 $returned=sprintf("IFD %02d: ", $key2).$val2->toString()."<br>"; 126 127 foreach($val2->getTags() as $key3 => $val3) 128 { 129 $returned.=dump_tag($key3, $val3->getTag(), "<span style='color:#804080;'>".sprintf("[%02d] ", $key3).$val3->toString()."</span><br>"); 130 131 if($val3->getTag()->getLabel() instanceof IfdReader) 132 { 133 $returned.="<div style='padding:1px;margin-bottom:2px;margin-right:4px;margin-left:25px;border:1px dotted #6060FF;'>"; 134 $returned.=dump_ifd($key3, $val3->getTag()->getLabel()); 135 $returned.="</div>"; 136 } 137 } 138 return($returned); 139 } 140 141 142 function dump_xmp($key2, $val2) 143 { 144 if(is_string($val2->getValue())) 145 $extra=$val2->getValue(); 146 elseif(is_array($val2->getValue())) 147 $extra=print_r($val2->getValue(), true); 148 else 149 $extra=ConvertData::toHexDump($val2->getValue(), ByteType::ASCII); 150 151 $extra="<br><span style='color:#000000;'>".$extra."</span><br>"; 152 153 $returned="<div style='color:#000000;margin-left:12px;border-bottom:1px solid #808080;"; 154 if(!$val2->isKnown()) 155 { 156 $returned.="background:#ffd0d0;'>"; 157 } 158 elseif(!$val2->isImplemented()) 159 { 160 $returned.="background:#ffffd0;'>"; 161 } 162 else 163 { 164 $returned.="background:#d0ffd0;'>"; 165 $extra=""; 166 } 167 168 $returned.="<span style='color:#804080;'>".$val2->toString().$extra."</span></div>"; 169 170 return($returned); 171 } 172 173 174 function dump_tag($key3, $val3, $extra) 175 { 176 $returned="<div style='color:#000000;margin-left:12px;border-bottom:1px solid #808080;"; 177 if(!$val3->isKnown()) 178 { 179 $returned.="background:#ffd0d0;'>".$extra; 180 } 181 elseif(!$val3->isImplemented()) 182 { 183 $returned.="background:#ffffd0;'>".$extra; 184 } 185 else 186 { 187 $returned.="background:#d0ffd0;'>"; 188 } 189 190 $returned.=str_replace(" ", " ", " ").$val3->toString("small")."<br></div>"; 191 192 return($returned); 193 } 194 195 /* 196 function cmp($a, $b) 197 { 198 if ($a['value'] == $b['value']) { 199 return 0; 200 } 201 return ($a['value'] < $b['value']) ? -1 : 1; 202 } 203 204 function list_for_po() 205 { 206 207 $tmpTagName=Array(); 208 $tmpValues=Array(); 209 210 $tagList=Array( 211 new IfdTags(), 212 new XmpTags(), 213 new IptcTags(), 214 new GpsTags(), 215 new PentaxTags(), 216 ); 217 218 219 foreach($tagList as $key => $tag) 220 { 221 222 foreach($tag->getTags() as $key => $val) 223 { 224 if(array_key_exists('tagName', $val)) 225 $name=$val['tagName']; 226 else 227 $name=""; 228 229 if(is_string($key)) 230 $tKey=$key; 231 else 232 $tKey=sprintf("0x%04x", $key); 233 234 if($name!="") 235 $tKey.=" ($name)"; 236 237 if($name!="") 238 { 239 $tmpTagName[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $name); 240 } 241 else 242 { 243 $tmpTagName[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $key); 244 } 245 246 if(array_key_exists('tagValues', $val) and $val['translatable']) 247 { 248 foreach($val['tagValues'] as $key2 => $val2) 66 249 { 67 echo "<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>";250 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 68 251 } 69 break;70 case "close": 71 echo "<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."/".$val['tag']."</span>";72 if(array_key_exists("attributes", $val))73 foreach($val[' attributes'] as $key2 => $val2)252 } 253 254 if(array_key_exists('tagValues.special', $val) and $val['translatable']) 255 { 256 foreach($val['tagValues.special'] as $key2 => $val2) 74 257 { 75 echo "<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>";258 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 76 259 } 77 break;78 case "complete": 79 echo "<span style='color:#".$color[$val['level']]."'>(".$val['level'].")".str_repeat(" ", 3*$val['level'])."/".$val['tag']."</span>";80 if(array_key_exists("attributes", $val))81 foreach($val[' attributes'] as $key2 => $val2)260 } 261 262 if(array_key_exists('tagValues.specialNames', $val) and $val['translatable']) 263 { 264 foreach($val['tagValues.specialNames'] as $key2 => $val2) 82 265 { 83 echo "<br><span style='color:#".$color[$val['level']]."'>".str_repeat(" ", 5+3*$val['level'])."<i>[".$key2."] ".$val2."</i></span>";266 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 84 267 } 85 break; 86 } 87 if(array_key_exists('value', $val)) 88 echo " <span style='color:#ff00ff;'>".$val['value']."</span>"; 89 echo "<br>"; 90 91 } 92 93 $tmp=new XmlData($xml); 94 95 //echo "has node:".($tmp->hasNodes()?"Y":"N")."<br>"; 96 97 dump_node($tmp->getFirstNode()); 98 99 100 } 101 102 function dump_node($node) 103 { 104 if($node==NULL) 105 return(false); 106 //echo "name:".$node->getName()." / level:".$node->getLevel()." / attributes: ".count($node->getAttributes())." / has child:".($node->hasChilds()?"Y":"N")."<br>"; 107 108 if($node->hasChilds()) 109 { 110 dump_node($node->getFirstChild()); 111 } 112 113 dump_node($node->getNextNode()); 114 } 115 116 function dump_ifd($key2, $val2) 117 { 118 echo sprintf("IFD %02d: ", $key2).$val2->toString()."<br>"; 119 120 foreach($val2->getTags() as $key3 => $val3) 121 { 122 dump_tag($key3, $val3->getTag(), "<span style='color:#804080;'>".sprintf("[%02d] ", $key3).$val3->toString()."</span><br>"); 123 124 /* 125 if($val3->isOffset()) 126 { 127 echo "<div style='color:#ff0000;margin-left:40px;'>"; 128 echo ConvertData::toHexDump($val3->getValue(), $val3->getType(),15)." => ".substr($val3->getValue(),0,254)."<br>"; 129 echo "</div>"; 130 } 131 */ 132 133 if($val3->getTag()->getLabel() instanceof IfdReader) 134 { 135 echo "<div style='padding:1px;margin-bottom:2px;margin-right:4px;margin-left:25px;border:1px dotted #6060FF;'>"; 136 dump_ifd($key3, $val3->getTag()->getLabel()); 137 echo "</div>"; 138 } 139 } 140 } 141 142 function dump_xmp($key2, $val2) 143 { 144 if(is_string($val2->getValue())) 145 $extra=$val2->getValue(); 146 elseif(is_array($val2->getValue())) 147 $extra=print_r($val2->getValue(), true); 268 } 269 270 if(array_key_exists('tagValues.specialValues', $val) and $val['translatable']) 271 { 272 foreach($val['tagValues.specialValues'] as $key2 => $val2) 273 { 274 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 275 } 276 } 277 278 if(array_key_exists('tagValues.computed', $val) and $val['translatable']) 279 { 280 foreach($val['tagValues.computed'] as $key2 => $val2) 281 { 282 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 283 } 284 } 285 286 287 } 288 289 } 290 291 $tmp=array_merge($tmpTagName, $tmpValues); 292 usort($tmp, "cmp"); 293 294 foreach($tmp as $key => $val) 295 { 296 echo "#. ".$val['group']."<br>"; 297 echo "msgid \"".$val['value']."\"<br>"; 298 echo "msgstr \"".$val['value']."\"<br><br>"; 299 } 300 301 } 302 */ 303 304 305 $page="<html><header><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></header><body>"; 306 307 308 $page.="<hr>-- Images --<br>"; 309 310 /* 311 * display a list of jpeg files in the current directory 312 */ 313 $directory = scandir(dirname(__FILE__)); 314 315 foreach($directory as $key => $file) 316 { 317 if(preg_match("/.*\.(jpg|jpeg)/i",$file)) 318 $page.="[<a href='?file=".$file."'>$file</a>] "; 319 } 320 321 322 $page.="<hr>-- Resultat --<br>"; 323 324 325 if(isset($_GET["file"])) 326 { 327 $file=$_GET["file"]; 328 } 148 329 else 149 $extra=ConvertData::toHexDump($val2->getValue(), ByteType::ASCII); 150 151 $extra="<br><span style='color:#000000;'>".$extra."</span><br>"; 152 153 echo "<div style='color:#000000;margin-left:12px;border-bottom:1px solid #808080;"; 154 if(!$val2->getIsKnown()) 155 { 156 echo "background:#ffd0d0;'>"; 157 } 158 elseif(!$val2->getIsImplemented()) 159 { 160 echo "background:#ffffd0;'>"; 161 } 162 else 163 { 164 echo "background:#d0ffd0;'>"; 165 $extra=""; 166 } 167 168 echo "<span style='color:#804080;'>".$val2->toString().$extra; 169 /* if($val2->getName()!=$val2->getId()) 170 echo " ==> Id: ".$val2->getId();*/ 171 echo "</span>"; 172 173 echo "</div>"; 174 } 175 176 function dump_tag($key3, $val3, $extra) 177 { 178 echo "<div style='color:#000000;margin-left:12px;border-bottom:1px solid #808080;"; 179 if(!$val3->getIsKnown()) 180 { 181 echo "background:#ffd0d0;'>".$extra; 182 } 183 elseif(!$val3->getIsImplemented()) 184 { 185 echo "background:#ffffd0;'>".$extra; 186 } 187 else 188 { 189 echo "background:#d0ffd0;'>"; 190 } 191 192 echo str_replace(" ", " ", " ").$val3->toString("small")."<br>"; 193 194 echo "</div>"; 195 } 196 197 /* 198 function cmp($a, $b) 199 { 200 if ($a['value'] == $b['value']) { 201 return 0; 202 } 203 return ($a['value'] < $b['value']) ? -1 : 1; 204 } 205 206 function list_for_po() 207 { 208 209 $tmpTagName=Array(); 210 $tmpValues=Array(); 211 212 $tagList=Array( 213 new IfdTags(), 214 new XmpTags(), 215 new IptcTags(), 216 new GpsTags(), 217 new PentaxTags(), 218 ); 219 220 221 foreach($tagList as $key => $tag) 222 { 223 224 foreach($tag->getTags() as $key => $val) 225 { 226 if(array_key_exists('tagName', $val)) 227 $name=$val['tagName']; 228 else 229 $name=""; 230 231 if(is_string($key)) 232 $tKey=$key; 233 else 234 $tKey=sprintf("0x%04x", $key); 235 236 if($name!="") 237 $tKey.=" ($name)"; 238 239 if($name!="") 240 { 241 $tmpTagName[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $name); 242 } 243 else 244 { 245 $tmpTagName[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $key); 246 } 247 248 if(array_key_exists('tagValues', $val) and $val['translatable']) 249 { 250 foreach($val['tagValues'] as $key2 => $val2) 251 { 252 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 253 } 254 } 255 256 if(array_key_exists('tagValues.special', $val) and $val['translatable']) 257 { 258 foreach($val['tagValues.special'] as $key2 => $val2) 259 { 260 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 261 } 262 } 263 264 if(array_key_exists('tagValues.specialNames', $val) and $val['translatable']) 265 { 266 foreach($val['tagValues.specialNames'] as $key2 => $val2) 267 { 268 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 269 } 270 } 271 272 if(array_key_exists('tagValues.specialValues', $val) and $val['translatable']) 273 { 274 foreach($val['tagValues.specialValues'] as $key2 => $val2) 275 { 276 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 277 } 278 } 279 280 if(array_key_exists('tagValues.computed', $val) and $val['translatable']) 281 { 282 foreach($val['tagValues.computed'] as $key2 => $val2) 283 { 284 $tmpValues[]=Array('group' => $tag->getLabel()." / ".$tKey, 'value' => $val2); 285 } 286 } 287 288 289 } 290 291 } 292 293 $tmp=array_merge($tmpTagName, $tmpValues); 294 usort($tmp, "cmp"); 295 296 foreach($tmp as $key => $val) 297 { 298 echo "#. ".$val['group']."<br>"; 299 echo "msgid \"".$val['value']."\"<br>"; 300 echo "msgstr \"".$val['value']."\"<br><br>"; 301 } 302 303 } 304 */ 305 306 if(isset($_GET["file"])) 307 { 308 $file=$_GET["file"]; 309 } 310 else 311 { 312 die("no filename ?<br/></body></html>"); 313 } 330 { 331 $page.="no filename ?<br/></body></html>"; 332 die($page); 333 } 334 335 $page.="<span style='font-family:monospace;'>"; 314 336 315 337 $memory=memory_get_usage(); 316 echo "memory : ".$memory."<br>";338 $time=microtime(true); 317 339 318 340 $jpeg = new JpegReader($file); 319 echo "<span style='font-family:monospace;'>JpegReader<br>"; 320 echo "fileName=".$jpeg->getFileName()."<br>"; 321 echo "isValid=".($jpeg->isValid()?"Y":"N")."<br>"; 322 echo "isLoaded=".($jpeg->isLoaded()?"Y":"N")."<br>"; 323 echo "NbMarkers=".$jpeg->countAppMarkerSegments()."<br>"; 341 $time2=microtime(true); 342 343 $page2="JpegReader extraction<br>"; 344 $page2.="fileName=".$jpeg->getFileName()."<br>"; 345 $page2.="isValid=".($jpeg->isValid()?"Y":"N")."<br>"; 346 $page2.="isLoaded=".($jpeg->isLoaded()?"Y":"N")."<br>"; 347 $page2.="NbMarkers=".$jpeg->countAppMarkerSegments()."<br>"; 348 324 349 foreach($jpeg->getAppMarkerSegments() as $key => $val) 325 350 { 326 echo"<div style='border:1px solid #000000;padding:4px;margin:1px;'>";327 echosprintf("[%02d] ", $key).$val->toString()."<br>";351 $page2.="<div style='border:1px solid #000000;padding:4px;margin:1px;'>"; 352 $page2.=sprintf("[%02d] ", $key).$val->toString()."<br>"; 328 353 if($val->dataLoaded()) 329 354 { 330 echo"<div style='color:#0000ff;font-weight:bold;margin-left:20px;'>";355 $page2.="<div style='color:#0000ff;font-weight:bold;margin-left:20px;'>"; 331 356 $data=$val->getData(); 332 357 if($data instanceof TiffReader) 333 358 { 334 echo$data->toString()."<br>";359 $page2.=$data->toString()."<br>"; 335 360 336 361 foreach($data->getIFDs() as $key2 => $val2) 337 362 { 338 echo "<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 339 340 dump_ifd($key2, $val2); 341 342 echo "</div>"; 343 } 344 363 $page2.="<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 364 $page2.=dump_ifd($key2, $val2); 365 $page2.="</div>"; 366 } 345 367 } 346 368 elseif($data instanceof XmpReader) 347 369 { 348 echohtmlentities($data->toString())."<br>";349 echodump_xml($data->toString())."<br>";370 $page2.=htmlentities($data->toString())."<br>"; 371 $page2.=dump_xml($data->toString())."<br>"; 350 372 351 373 foreach($data->getTags() as $key2 => $val2) 352 374 { 353 echo "<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 354 355 dump_xmp($key2, $val2); 356 357 echo "</div>"; 358 } 359 360 375 $page2.="<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 376 $page2.=dump_xmp($key2, $val2); 377 $page2.="</div>"; 378 } 361 379 } 362 380 elseif($data instanceof IptcReader) … … 365 383 foreach($data->getTags() as $key2 => $val2) 366 384 { 367 echo "<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 368 369 dump_tag($key2, $val2, ""); 370 371 echo "</div>"; 372 } 373 374 385 $page2.="<div style='color:#0000ff;font-weight:normal;margin-left:12px;'>"; 386 $page2.=dump_tag($key2, $val2, ""); 387 $page2.="</div>"; 388 } 375 389 } 376 390 else 377 391 { 378 echo htmlentities($val->getData())."<br>"; 379 } 380 echo "</div>"; 381 } 382 echo "</div>"; 383 384 } 385 echo "</span><hr>"; 386 387 388 Locale::set("en_UK"); 389 390 echo "<span style='font-family:monospace;'>JpegMetaData - tag from test file<br>"; 391 echo "<table style='border:1px solid #000000;'>"; 392 echo "<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Value</th><th>Computed Value</th></tr>"; 392 $page2.=htmlentities($val->getData())."<br>"; 393 } 394 $page2.="</div>"; 395 } 396 $page2.="</div>"; 397 } 398 $page2.="</span><hr>"; 399 400 $page2.="<div style='font-family:monospace;'>JpegMetaData - tag from test file<br>"; 401 $page2.="<table style='border:1px solid #000000;width:100%;'>"; 402 $page2.="<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Value</th><th>Computed Value</th></tr>"; 403 393 404 $jpegmd = new JpegMetaData($file, Array( 394 405 'filter' => JpegMetaData::TAGFILTER_IMPLEMENTED, … … 402 413 $value=$val->getValue(); 403 414 404 if($val-> getIsTranslatable())415 if($val->isTranslatable()) 405 416 $style="color:#0000ff"; 406 417 else 407 418 $style="color:#000000"; 408 419 409 if(is_string($txt) and $val-> getIsTranslatable())420 if(is_string($txt) and $val->isTranslatable()) 410 421 $txt=Locale::get($txt); 411 422 if($txt instanceof DateTime) … … 415 426 if(is_array($value)) 416 427 $value=print_r($value, true); 417 echo"<tr><td>".$key."</td><td>".Locale::get($val->getName())."</td><td>".$value."</td><td style='$style'>".$txt."</td></tr>";428 $page2.="<tr><td>".$key."</td><td>".Locale::get($val->getName())."</td><td>".$value."</td><td style='$style'>".$txt."</td></tr>"; 418 429 $i++; 419 430 } 420 echo "</table>Total tags: $i</span><hr>"; 431 $page2.="</table>Total tags: $i</div><hr>"; 432 421 433 422 434 $i=0; 423 435 $j=0; 424 echo "<spanstyle='font-family:monospace;'>JpegMetaData - known tags<br>";425 echo "<table style='border:1px solid #000000;'>";426 echo"<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Implemented</th></tr>";427 foreach( $jpegmd->getTagList(Array('filter' => JpegMetaData::TAGFILTER_ALL, 'xmp' => true, 'maker' => true, 'iptc' => true)) as $key => $val)436 $page2.="<div style='font-family:monospace;'>JpegMetaData - known tags<br>"; 437 $page2.="<table style='border:1px solid #000000;width:100%;'>"; 438 $page2.="<tr style='border-bottom:1x solid #000000;'><th>Key</th><th>Name</th><th>Implemented</th></tr>"; 439 foreach(JpegMetaData::getTagList(Array('filter' => JpegMetaData::TAGFILTER_ALL, 'xmp' => true, 'maker' => true, 'iptc' => true)) as $key => $val) 428 440 { 429 441 $val['implemented']?$i++:$j++; 430 echo"<tr><td>".$key."</td><td>".Locale::get($val['name'])."</td><td>".($val['implemented']?"yes":"no")."</td></tr>";431 } 432 echo"</table>Total tags ; implemented: $i - not implemented: $j</span><hr>";442 $page2.="<tr><td>".$key."</td><td>".Locale::get($val['name'])."</td><td>".($val['implemented']?"yes":"no")."</td></tr>"; 443 } 444 $page2.="</table>Total tags ; implemented: $i - not implemented: $j</span><hr>"; 433 445 434 446 unset($jpegmd); 435 447 unset($jpeg); 436 448 $memory2=memory_get_usage(); 437 echo "memory : ".$memory2." (memory leak ? = ".($memory2-$memory).")<br>"; 438 echo "<br/></body></html>"; 449 $page.="parsing time : ".($time2-$time)."<br>"; 450 $page.="memory on start : ".$memory."<br>"; 451 $page.="memory on end : ".$memory2." (memory leak ? = ".($memory2-$memory).")<br><br>"; 452 453 $page.=$page2; 454 $page.="<br/></body></html>"; 455 456 echo $page; 439 457 ?>
Note: See TracChangeset
for help on using the changeset viewer.