Changeset 12796 for trunk/include
- Timestamp:
- Dec 27, 2011, 6:26:44 AM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_monthly.class.php
r12118 r12796 351 351 $page['chronology_date'][CDAY]=$day; 352 352 $query = ' 353 SELECT id, file, tn_ext,path,width, height, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow';353 SELECT id, file,representative_ext,path,width, height, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow'; 354 354 $query.= $this->inner_sql; 355 355 $query.= $this->get_date_where(); … … 360 360 361 361 $row = pwg_db_fetch_assoc(pwg_query($query)); 362 $items[$day]['tn_url'] = get_thumbnail_url($row); 362 $derivative = new DerivativeImage(IMG_SQUARE, new SrcImage($row)); 363 $items[$day]['derivative'] = $derivative; 363 364 $items[$day]['file'] = $row['file']; 364 $items[$day]['path'] = $row['path'];365 $items[$day]['tn_ext'] = @$row['tn_ext'];366 $items[$day]['width'] = $row['width'];367 $items[$day]['height'] = $row['height'];368 365 $items[$day]['dow'] = $row['dow']; 369 366 } 370 367 371 if ( !empty($items) 372 and $conf['calendar_month_cell_width']>0 373 and $conf['calendar_month_cell_height']>0) 368 if ( !empty($items) ) 374 369 { 375 370 list($known_day) = array_keys($items); … … 397 392 } 398 393 399 $cell_width = $conf['calendar_month_cell_width']; 400 $cell_height = $conf['calendar_month_cell_height']; 394 list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size; 401 395 402 396 $tpl_weeks = array(); … … 431 425 else 432 426 { 433 $thumb = get_thumbnail_path($items[$day]); 434 $tn_size = @getimagesize($thumb); 435 436 $tn_width = $tn_size[0]; 437 $tn_height = $tn_size[1]; 427 list($tn_width,$tn_height) = $items[$day]['derivative']->get_size(); 438 428 439 429 // now need to fit the thumbnail of size tn_size within … … 492 482 'DOW' => $dow, 493 483 'NB_ELEMENTS' => $items[$day]['nb_images'], 494 'IMAGE' => $items[$day][' tn_url'],484 'IMAGE' => $items[$day]['derivative']->get_url(), 495 485 'U_IMG_LINK' => $url, 496 486 'IMAGE_STYLE' => $css_style, -
trunk/include/category_cats.inc.php
r12546 r12796 190 190 if ($row['level'] <= $user['level']) 191 191 { 192 $row['tn_src'] = get_thumbnail_url($row);192 $row['tn_src'] = DerivativeImage::thumb_url($row); 193 193 $infos_of_image[$row['id']] = $row; 194 194 } … … 237 237 while ($row = pwg_db_fetch_assoc($result)) 238 238 { 239 $row['tn_src'] = get_thumbnail_url($row);239 $row['tn_src'] = DerivativeImage::thumb_url($row); 240 240 $infos_of_image[$row['id']] = $row; 241 241 } -
trunk/include/category_default.inc.php
r12546 r12796 114 114 $tpl_var = array( 115 115 'ID' => $row['id'], 116 'TN_SRC' => get_thumbnail_url($row),116 'TN_SRC' => DerivativeImage::thumb_url($row), 117 117 'TN_ALT' => htmlspecialchars(strip_tags($name)), 118 118 'TN_TITLE' => get_thumbnail_title($row), -
trunk/include/common.inc.php
r12768 r12796 108 108 include(PHPWG_ROOT_PATH . 'include/constants.php'); 109 109 include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); 110 include( 110 include(PHPWG_ROOT_PATH .'include/template.class.php'); 111 111 112 112 // Database connection … … 132 132 } 133 133 } 134 135 ImageStdParams::load_from_db(); 134 136 135 137 load_plugins(); -
trunk/include/config_default.inc.php
r12768 r12796 89 89 //no elements for these 90 90 $conf['calendar_show_empty'] = true; 91 92 // calendar_month_cell_width, calendar_month_cell_height : define the93 // width and the height of a cell in the monthly calendar when viewing a94 // given month. a value of 0 means that the pretty view is not shown.95 // a good suggestion would be to have the width and the height equal96 // and smaller than upload thumbnails configuration size.97 $conf['calendar_month_cell_width'] =80;98 $conf['calendar_month_cell_height']=80;99 91 100 92 // newcat_default_commentable : at creation, must a category be commentable … … 761 753 // upload form or through pwg.images.addSimple web API method? 762 754 $conf['upload_form_automatic_rotation'] = true; 755 756 // 0-'auto', 1-'derivative' 2-'script' 757 $conf['derivative_url_style']=0; 758 759 $conf['chmod_value']=0777; 760 763 761 ?> -
trunk/include/constants.php
r12768 r12796 28 28 29 29 define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/'); 30 define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/'); 30 defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/'); 31 defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', PWG_LOCAL_DIR.'i/'); 31 32 32 33 // Required versions -
trunk/include/functions.inc.php
r12541 r12796 31 31 include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' ); 32 32 include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' ); 33 include_once( PHPWG_ROOT_PATH .'/include/derivative_params.inc.php'); 34 include_once( PHPWG_ROOT_PATH .'/include/derivative_std_params.inc.php'); 35 include_once( PHPWG_ROOT_PATH .'/include/derivative.inc.php'); 33 36 34 37 //----------------------------------------------------------- generic functions … … 168 171 if ( !is_dir($dir) ) 169 172 { 173 global $conf; 170 174 if (substr(PHP_OS, 0, 3) == 'WIN') 171 175 { … … 173 177 } 174 178 $umask = umask(0); 175 $mkd = @mkdir($dir, 0755, ($flags&MKGETDIR_RECURSIVE) ? true:false );179 $mkd = @mkdir($dir, $conf['chmod_value'], ($flags&MKGETDIR_RECURSIVE) ? true:false ); 176 180 umask($umask); 177 181 if ($mkd==false) -
trunk/include/functions_notification.inc.php
r8728 r12796 459 459 { // get some thumbnails ... 460 460 $query = ' 461 SELECT DISTINCT id, path, name, tn_ext, file461 SELECT DISTINCT id, path, name, representative_ext, file 462 462 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id 463 463 '.$where_sql.' … … 536 536 foreach($date_detail['elements'] as $element) 537 537 { 538 $tn_src = get_thumbnail_url($element);538 $tn_src = DerivativeImage::thumb_url($element); 539 539 $description .= '<a href="'. 540 540 make_picture_url(array( -
trunk/include/picture_metadata.inc.php
r12131 r12796 27 27 */ 28 28 29 // $picture['current']['high_url'] may not be set if the user has no access30 // to the high definition, but we may want to display metadata and read the31 // high definition is available32 $high_url = null;33 if (isset($picture['current']['high_url']))34 {35 $high_url = $picture['current']['high_url'];36 }37 else38 {39 $high_url = get_high_url($picture['current']);40 }41 29 42 30 include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); … … 50 38 51 39 $exif = get_exif_data($picture['current']['image_path'], $exif_mapping); 52 if (count($exif) == 0 and $picture['current']['has_high'])53 {54 $exif = get_exif_data($high_url, $exif_mapping);55 }56 40 57 41 if (count($exif) > 0) … … 97 81 { 98 82 $iptc = get_iptc_data($picture['current']['image_path'], $conf['show_iptc_mapping']); 99 if (count($iptc) == 0 and $picture['current']['has_high'])100 {101 $iptc = get_iptc_data($high_url, $conf['show_iptc_mapping']);102 }103 83 104 84 if (count($iptc) > 0) -
trunk/include/ws_functions.inc.php
r12749 r12796 147 147 function ws_std_get_urls($image_row) 148 148 { 149 $ret = array( 150 'tn_url' => get_thumbnail_url($image_row), 151 'element_url' => get_element_url($image_row) 152 ); 149 $ret = array(); 153 150 global $user; 154 if ($user['enabled_high'] and $image_row['has_high'] ) 155 { 156 $ret['high_url'] = get_high_url($image_row); 157 } 151 if ($user['enabled_high']) 152 { 153 $ret['element_url'] = get_element_url($image_row); 154 } 155 156 $derivatives = DerivativeImage::get_all($image_row); 157 $derivatives_arr = array(); 158 foreach($derivatives as $type=>$derivative) 159 { 160 $size = $derivative->get_size(); 161 $size != null or $size=array(null,null); 162 $derivatives_arr[$type] = array('url' => $derivative->get_url(), 'width'=>$size[0], 'height'=>$size[1] ); 163 } 164 $ret['derivatives'] = $derivatives_arr;; 158 165 return $ret; 159 166 } … … 166 173 { 167 174 return array( 168 'id',' tn_url','element_url','high_url', 'file','width','height','hit','date_available','date_creation'175 'id','element_url', 'file','width','height','hit','date_available','date_creation' 169 176 ); 170 177 } … … 621 628 622 629 $query = ' 623 SELECT id, path, tn_ext, level630 SELECT id, path, representative_ext, level 624 631 FROM '.IMAGES_TABLE.' 625 632 WHERE id IN ('.implode(',', $image_ids).') … … 630 637 if ($row['level'] <= $user['level']) 631 638 { 632 $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);639 $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row); 633 640 } 634 641 else … … 669 676 { 670 677 $query = ' 671 SELECT id, path, tn_ext678 SELECT id, path, representative_ext 672 679 FROM '.IMAGES_TABLE.' 673 680 WHERE id IN ('.implode(',', $new_image_ids).') … … 676 683 while ($row = pwg_db_fetch_assoc($result)) 677 684 { 678 $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);685 $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row); 679 686 } 680 687 } … … 1371 1378 if (!is_dir($upload_dir)) { 1372 1379 umask(0000); 1373 $recursive = true; 1374 if (!@mkdir($upload_dir, 0777, $recursive)) 1380 if (!@mkdir($upload_dir, 0777, true)) 1375 1381 { 1376 1382 return new PwgError(500, 'error during buffer directory creation'); … … 1425 1431 if (is_file($output_filepath)) 1426 1432 { 1427 new PwgError(500, '[merge_chunks] error while trying to remove existing '.$output_filepath); 1428 exit(); 1433 return new PwgError(500, '[merge_chunks] error while trying to remove existing '.$output_filepath); 1429 1434 } 1430 1435 } … … 1465 1470 if (!file_put_contents($output_filepath, $string, FILE_APPEND)) 1466 1471 { 1467 new PwgError(500, '[merge_chunks] error while writting chunks for '.$output_filepath); 1468 exit(); 1472 return new PwgError(500, '[merge_chunks] error while writting chunks for '.$output_filepath); 1469 1473 } 1470 1474 … … 1501 1505 if (!@mkdir($upload_dir, 0777, $recursive)) 1502 1506 { 1503 new PwgError(500, '[add_file] error during '.$type.' directory creation'); 1504 exit(); 1507 return new PwgError(500, '[add_file] error during '.$type.' directory creation'); 1505 1508 } 1506 1509 } … … 1513 1516 if (!is_writable($upload_dir)) 1514 1517 { 1515 new PwgError(500, '[add_file] '.$type.' directory has no write access'); 1516 exit(); 1518 return new PwgError(500, '[add_file] '.$type.' directory has no write access'); 1517 1519 } 1518 1520 } … … 1526 1528 // check dumped thumbnail md5 1527 1529 $dumped_md5 = md5_file($file_path); 1528 if ($dumped_md5 != $file_sum) {1529 new PwgError(500, '[add_file] '.$type.' transfer failed');1530 exit();1530 if ($dumped_md5 != $file_sum) 1531 { 1532 return new PwgError(500, '[add_file] '.$type.' transfer failed'); 1531 1533 } 1532 1534 … … 2452 2454 else 2453 2455 { 2454 new PwgError(2456 return new PwgError( 2455 2457 500, 2456 2458 '[ws_images_setInfo]' … … 2458 2460 .', possible values are {fill_if_empty, replace}.' 2459 2461 ); 2460 exit();2461 2462 } 2462 2463 } … … 2467 2468 if (!empty($image_row['storage_category_id'])) 2468 2469 { 2469 new PwgError(500, '[ws_images_setInfo] updating "file" is forbidden on photos added by synchronization'); 2470 exit(); 2470 return new PwgError(500, '[ws_images_setInfo] updating "file" is forbidden on photos added by synchronization'); 2471 2471 } 2472 2472 … … 2518 2518 else 2519 2519 { 2520 new PwgError(2520 return new PwgError( 2521 2521 500, 2522 2522 '[ws_images_setInfo]' … … 2524 2524 .', possible values are {replace, append}.' 2525 2525 ); 2526 exit();2527 2526 } 2528 2527 } … … 2611 2610 if (count($cat_ids) == 0) 2612 2611 { 2613 new PwgError(2612 return new PwgError( 2614 2613 500, 2615 2614 '[ws_add_image_category_relations] there is no category defined in "'.$categories_string.'"' 2616 2615 ); 2617 exit();2618 2616 } 2619 2617 … … 2629 2627 if (count($unknown_cat_ids) != 0) 2630 2628 { 2631 new PwgError(2629 return new PwgError( 2632 2630 500, 2633 2631 '[ws_add_image_category_relations] the following categories are unknown: '.implode(', ', $unknown_cat_ids) 2634 2632 ); 2635 exit();2636 2633 } 2637 2634
Note: See TracChangeset
for help on using the changeset viewer.