Changeset 1144 for branches/branch-1_6/tools/create_listing_file.php
- Timestamp:
- Apr 11, 2006, 5:54:42 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_6/tools/create_listing_file.php
r1046 r1144 83 83 { 84 84 $result = array(); 85 85 86 86 // Read IPTC data 87 87 $iptc = array(); 88 88 89 89 $imginfo = array(); 90 90 getimagesize($filename, $imginfo); 91 91 92 92 if (isset($imginfo['APP13'])) 93 93 { … … 136 136 // remove binary nulls 137 137 $value = str_replace(chr(0x00), ' ', $value); 138 138 139 139 return htmlentities($value); 140 140 } … … 146 146 $map = $conf['use_iptc_mapping']; 147 147 $datefields = array('date_creation', 'date_available'); 148 148 149 149 $iptc = get_iptc_data($file, $map); 150 150 … … 162 162 if (isset($iptc['keywords'])) 163 163 { 164 // keywords separator is the comma, nothing else. Allowed characters in 165 // keywords : [A-Za-z0-9], "-" and "_". All other characters will be 166 // considered as separators 167 $iptc['keywords'] = preg_replace('/[^\w-]+/', ',', $iptc['keywords']); 164 // official keywords separator is the comma 165 $iptc['keywords'] = preg_replace('/[.;]/', ',', $iptc['keywords']); 168 166 $iptc['keywords'] = preg_replace('/^,+|,+$/', '', $iptc['keywords']); 169 167 } … … 243 241 244 242 $prefix_length = strlen($conf['prefix_thumbnail']); 245 243 246 244 $thumbnails = array(); 247 245 if ($opendir = @opendir($dir.'/thumbnail')) … … 350 348 $dirs.= "\n".$indent.'</dir'.$level.'>'; 351 349 } 352 return $dirs; 350 return $dirs; 353 351 } 354 352 … … 370 368 { 371 369 global $conf, $page; 372 370 373 371 // fs means FileSystem : $fs_files contains files in the filesystem found 374 372 // in $dir that can be managed by PhpWebGallery (see get_pwg_files … … 384 382 $print_dir = preg_replace('/^\.\//', '', $dir); 385 383 $print_dir = preg_replace('/\/*$/', '/', $print_dir); 386 384 387 385 foreach ($fs_files as $fs_file) 388 386 { … … 391 389 $element['path'] = $page['url'].$print_dir.$fs_file; 392 390 $element['filesize'] = floor(filesize($dir.'/'.$fs_file) / 1024); 393 391 394 392 $file_wo_ext = get_filename_wo_extension($fs_file); 395 393 … … 409 407 410 408 // 2 cases : the element is a picture or not. Indeed, for a picture 411 // thumbnail is mandatory, high is optional and for non picture element, 409 // thumbnail is mandatory, high is optional and for non picture element, 412 410 // thumbnail and representative is optionnal 413 411 if (in_array(get_extension($fs_file), $conf['picture_ext'])) … … 421 419 $element['height'] = $image_size[1]; 422 420 } 423 421 424 422 if ( in_array($fs_file, $fs_highs) ) 425 423 { … … 465 463 } 466 464 } 467 465 468 466 array_push($elements, $element); 469 467 } … … 493 491 } 494 492 } 495 493 496 494 array_push($elements, $element); 497 495 } … … 538 536 { 539 537 $start = get_moment(); 540 538 541 539 $listing = '<informations'; 542 540 $listing.= ' generation_date="'.date('Y-m-d').'"'; 543 541 $listing.= ' phpwg_version="'.htmlentities($conf{'version'}).'"'; 544 542 545 543 $attrs=array(); 546 544 if ($conf['use_iptc']) … … 553 551 } 554 552 $listing.= ' metadata="'.implode(',',array_unique($attrs)).'"'; 555 553 556 554 $end = strrpos($_SERVER['PHP_SELF'], '/') + 1; 557 555 $local_folder = substr($_SERVER['PHP_SELF'], 0, $end); 558 556 $page['url'] = 'http://'.$_SERVER['HTTP_HOST'].$local_folder; 559 557 560 558 $listing.= ' url="'.$page['url'].'"'; 561 559 $listing.= '/>'."\n"; 562 560 563 561 $listing.= get_dirs('.', '', 0); 564 562 565 563 if ($fp = @fopen("./listing.xml","w")) 566 564 {
Note: See TracChangeset
for help on using the changeset viewer.