Changeset 12796
- Timestamp:
- 12/27/11 06:26:44 (17 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 23 modified
-
admin/batch_manager_global.php (modified) (2 diffs)
-
admin/batch_manager_unit.php (modified) (2 diffs)
-
admin/cat_modify.php (modified) (3 diffs)
-
admin/comments.php (modified) (2 diffs)
-
admin/element_set_ranks.php (modified) (3 diffs)
-
admin/history.php (modified) (6 diffs)
-
admin/picture_modify.php (modified) (1 diff)
-
admin/rating.php (modified) (2 diffs)
-
admin/rating_user.php (modified) (3 diffs)
-
admin/themes/default/template/rating_user.tpl (modified) (2 diffs)
-
comments.php (modified) (2 diffs)
-
i.php (added)
-
include/calendar_monthly.class.php (modified) (5 diffs)
-
include/category_cats.inc.php (modified) (2 diffs)
-
include/category_default.inc.php (modified) (1 diff)
-
include/common.inc.php (modified) (2 diffs)
-
include/config_default.inc.php (modified) (2 diffs)
-
include/constants.php (modified) (1 diff)
-
include/derivative.inc.php (added)
-
include/derivative_params.inc.php (added)
-
include/derivative_std_params.inc.php (added)
-
include/functions.inc.php (modified) (3 diffs)
-
include/functions_notification.inc.php (modified) (2 diffs)
-
include/picture_metadata.inc.php (modified) (3 diffs)
-
include/ws_functions.inc.php (modified) (19 diffs)
-
picture.php (modified) (9 diffs)
-
themes/default/template/picture_content.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r12748 r12796 712 712 713 713 $query = ' 714 SELECT id,path, tn_ext,file,filesize,level,name714 SELECT id,path,representative_ext,file,filesize,level,name 715 715 FROM '.IMAGES_TABLE; 716 716 … … 748 748 { 749 749 $nb_thumbs_page++; 750 $src = get_thumbnail_url($row);750 $src = DerivativeImage::thumb_url($row); 751 751 752 752 $title = $row['name']; -
trunk/admin/batch_manager_unit.php
r11853 r12796 202 202 203 203 $query = ' 204 SELECT id,path, tn_ext,name,date_creation,comment,author,level,file204 SELECT id,path,representative_ext,name,date_creation,comment,author,level,file 205 205 FROM '.IMAGES_TABLE; 206 206 … … 238 238 array_push($element_ids, $row['id']); 239 239 240 $src = get_thumbnail_url($row);240 $src = DerivativeImage::thumb_url($row); 241 241 242 242 // creation date -
trunk/admin/cat_modify.php
r12591 r12796 302 302 { 303 303 $query = ' 304 SELECT id, tn_ext,path304 SELECT id,representative_ext,path 305 305 FROM '.IMAGES_TABLE.' 306 306 WHERE id = '.$category['representative_picture_id'].' 307 307 ;'; 308 308 $row = pwg_db_fetch_assoc(pwg_query($query)); 309 $src = get_thumbnail_url($row);309 $src = DerivativeImage::thumb_url($row); 310 310 $url = get_root_url().'admin.php?page=picture_modify'; 311 311 $url.= '&image_id='.$category['representative_picture_id']; … … 388 388 { 389 389 $query = ' 390 SELECT id, file, path, tn_ext390 SELECT id, file, path, representative_ext 391 391 FROM '.IMAGES_TABLE.' 392 392 WHERE id = '.$category['representative_picture_id'].' … … 404 404 'category' => $category 405 405 )) 406 .'" class="thumblnk"><img src="'. get_thumbnail_url($element).'"></a>';406 .'" class="thumblnk"><img src="'.DerivativeImage::thumb_url($element).'"></a>'; 407 407 } 408 408 } -
trunk/admin/comments.php
r12596 r12796 100 100 $query = ' 101 101 SELECT c.id, c.image_id, c.date, c.author, '. 102 $conf['user_fields']['username'].' AS username, c.content, i.path, i. tn_ext102 $conf['user_fields']['username'].' AS username, c.content, i.path, i.representative_ext 103 103 FROM '.COMMENTS_TABLE.' AS c 104 104 INNER JOIN '.IMAGES_TABLE.' AS i … … 112 112 while ($row = pwg_db_fetch_assoc($result)) 113 113 { 114 $thumb = get_thumbnail_url(114 $thumb = DerivativeImage::thumb_url( 115 115 array( 116 116 'id'=>$row['image_id'], -
trunk/admin/element_set_ranks.php
r12782 r12796 200 200 file, 201 201 path, 202 tn_ext, 202 representative_ext, 203 width, height, 203 204 name, 204 205 rank … … 215 216 $thumbnail_info=array(); 216 217 $clipping=array(); 218 $derivativeParams = ImageStdParams::get_by_type(IMG_SQUARE); 217 219 while ($row = pwg_db_fetch_assoc($result)) 218 220 { 219 $src = get_thumbnail_url($row);220 221 $thumbnail_size = getimagesize($src);221 $derivative = new DerivativeImage($derivativeParams, new SrcImage($row)); 222 223 $thumbnail_size = $derivative->get_size(); 222 224 if ( !empty( $row['name'] ) ) 223 225 { … … 234 236 'height' => $thumbnail_size[1], 235 237 'id' => $row['id'], 236 'tn_src' => $ src,238 'tn_src' => $derivative->get_url(), 237 239 'rank' => $current_rank * 10, 238 240 ); -
trunk/admin/history.php
r9808 r12796 304 304 file, 305 305 path, 306 tn_ext306 representative_ext 307 307 FROM '.IMAGES_TABLE.' 308 308 WHERE id IN ('.implode(',', array_keys($image_ids)).') … … 314 314 $file_of_image = array(); 315 315 $path_of_image = array(); 316 $ tn_ext_of_image = array();316 $representative_ext_of_image = array(); 317 317 318 318 $result = pwg_query($query); … … 333 333 $file_of_image[ $row['id'] ] = $row['file']; 334 334 $path_of_image[ $row['id'] ] = $row['path']; 335 $ tn_ext_of_image[ $row['id'] ] = $row['tn_ext'];335 $representative_ext_of_image[ $row['id'] ] = $row['representative_ext']; 336 336 } 337 337 … … 455 455 'file' => $file_of_image[$line['image_id']], 456 456 'path' => $path_of_image[$line['image_id']], 457 ' tn_ext' => $tn_ext_of_image[$line['image_id']],457 'representative_ext' => $representative_ext_of_image[$line['image_id']], 458 458 ); 459 459 $thumbnail_display = $page['search']['fields']['display_thumbnail']; … … 488 488 $image_string = 489 489 '<a class="thumbnail" href="'.$picture_url.'">' 490 .'<span><img src="'. get_thumbnail_url($element)490 .'<span><img src="'.DerivativeImage::thumb_url($element) 491 491 .'" alt="'.$image_title.'" title="'.$image_title.'">' 492 492 .'</span></a>'; … … 497 497 $image_string = 498 498 '<a class="over" href="'.$picture_url.'">' 499 .'<span><img src="'. get_thumbnail_url($element)499 .'<span><img src="'.DerivativeImage::thumb_url($element) 500 500 .'" alt="'.$image_title.'" title="'.$image_title.'">' 501 501 .'</span>'.$image_title.'</a>'; -
trunk/admin/picture_modify.php
r12612 r12796 283 283 'PATH'=>$row['path'], 284 284 285 'TN_SRC' => get_thumbnail_url($row),285 'TN_SRC' => DerivativeImage::thumb_url($row), 286 286 287 287 'NAME' => -
trunk/admin/rating.php
r12624 r12796 185 185 i.path, 186 186 i.file, 187 i. tn_ext,187 i.representative_ext, 188 188 i.rating_score, 189 189 r.element_id … … 202 202 foreach ($images as $image) 203 203 { 204 $thumbnail_src = get_thumbnail_url($image);204 $thumbnail_src = DerivativeImage::thumb_url($image); 205 205 206 206 $image_url = PHPWG_ROOT_PATH.'admin.php?page=picture_modify'. -
trunk/admin/rating_user.php
r12650 r12796 102 102 if (count($image_ids) > 0 ) 103 103 { 104 $query = 'SELECT id, name, file, path, tn_ext104 $query = 'SELECT id, name, file, path, representative_ext 105 105 FROM '.IMAGES_TABLE.' 106 106 WHERE id IN ('.implode(',', array_keys($image_ids)).')'; … … 109 109 { 110 110 $image_urls[ $row['id'] ] = array( 111 'tn' => get_thumbnail_url($row),111 'tn' => DerivativeImage::thumb_url($row), 112 112 'page' => make_picture_url( array('image_id'=>$row['id'], 'image_file'=>$row['file']) ), 113 113 ); … … 218 218 'ratings' => $by_user_ratings, 219 219 'image_urls' => $image_urls, 220 'TN_WIDTH' => 2 0+2*$conf['upload_form_thumb_maxwidth'],220 'TN_WIDTH' => 28+2*ImageStdParams::get_by_type(IMG_THUMB)->sizing->ideal_size[0], 221 221 ) ); 222 222 $template->set_filename('rating', 'rating_user.tpl'); -
trunk/admin/themes/default/template/rating_user.tpl
r12650 r12796 60 60 {capture assign=rate_over}{foreach from=$rates item=rate_arr}<img src="{$image_urls[$rate_arr.id].tn}" alt="thumb-{$rate_arr.id}" title="{$rate_arr.date}"></img> 61 61 {/foreach}{/capture} 62 <a class="cluetip" title=" {$rate_over|@htmlspecialchars}">{$rates|@count}</a>62 <a class="cluetip" title="|{$rate_over|@htmlspecialchars}">{$rates|@count}</a> 63 63 {/if}</td> 64 64 {/foreach} … … 72 72 jQuery(document).ready(function(){ldelim} 73 73 jQuery('.cluetip').cluetip({ldelim} 74 width: {$TN_WIDTH}, s plitTitle: '|'74 width: {$TN_WIDTH}, showTitle:false, splitTitle: '|' 75 75 }); 76 76 }) -
trunk/comments.php
r12765 r12796 409 409 $elements = array(); 410 410 $query = ' 411 SELECT id, name, file, path, tn_ext411 SELECT id, name, file, path, representative_ext 412 412 FROM '.IMAGES_TABLE.' 413 413 WHERE id IN ('.implode(',', $element_ids).') … … 451 451 452 452 // source of the thumbnail picture 453 $thumbnail_src = get_thumbnail_url( $elements[$comment['image_id']] );453 $thumbnail_src = DerivativeImage::thumb_url( $elements[$comment['image_id']] ); 454 454 455 455 // link to the full size picture -
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( PHPWG_ROOT_PATH .'include/template.class.php');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 -
trunk/picture.php
r12767 r12796 22 22 // +-----------------------------------------------------------------------+ 23 23 24 define('PHPWG_ROOT_PATH',' ./');24 define('PHPWG_ROOT_PATH',''); 25 25 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 26 26 include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); … … 154 154 return $content; 155 155 } 156 if (!isset($element_info['image_url'])) 157 { // nothing to do 158 return $content; 156 157 if (isset($_COOKIE['picture_deriv'])) 158 { 159 pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']); 160 setcookie('picture_deriv', false, 0); 161 } 162 $deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE); 163 $selected_derivative = $element_info['derivatives'][$deriv_type]; 164 165 $available_derivatives = array(); 166 $added = array(); 167 foreach($element_info['derivatives'] as $type => $derivative) 168 { 169 $url = $derivative->get_url(); 170 if (isset($added[$url])) 171 continue; 172 $added[$url] = 1; 173 $available_derivatives[] = $type; 159 174 } 160 175 161 176 global $user, $page, $template; 177 178 $template->append('current', array( 179 'selected_derivative' => $selected_derivative, 180 'available_derivative_types' => $available_derivatives, 181 ), true); 182 162 183 163 184 $template->set_filenames( … … 165 186 ); 166 187 167 if ( !$page['slideshow'] and isset($element_info['high_url']) )168 {169 $uuid = uniqid(rand());170 $template->assign(171 'high',172 array(173 'U_HIGH' => $element_info['high_url'],174 'UUID' => $uuid,175 )176 );177 }178 188 $template->assign( array( 179 'SRC_IMG' => $element_info['image_url'],180 189 'ALT_IMG' => $element_info['file'], 181 'WIDTH_IMG' => @$element_info['scaled_width'],182 'HEIGHT_IMG' => @$element_info['scaled_height'],183 190 ) 184 191 ); … … 404 411 } 405 412 406 // incrementation of the number of hits, we do this only if no action413 //---------- incrementation of the number of hits, we do this only if no action 407 414 if (trigger_event('allow_increment_element_hit_count', !isset($_POST['content']) ) ) 408 415 { … … 493 500 } 494 501 502 $picture[$i]['derivatives'] = DerivativeImage::get_all($row); 503 $picture[$i]['src_image'] = $picture[$i]['derivatives'][IMG_THUMB]->src_image; 504 $picture[$i]['thumbnail'] = $picture[$i]['derivatives'][IMG_THUMB]->get_url(); 505 495 506 // ------ build element_path and element_url 496 507 $picture[$i]['element_path'] = get_element_path($picture[$i]); … … 510 521 if ( $user['enabled_high']=='true' ) 511 522 { 512 $hi_url=get_high_url($picture[$i]); 513 if ( !empty($hi_url) ) 514 { 515 $picture[$i]['high_url'] = $hi_url; 516 $picture[$i]['download_url'] = get_download_url('h',$picture[$i]); 517 } 523 $picture[$i]['download_url'] = get_download_url('e',$picture[$i]); 518 524 } 519 525 } … … 524 530 } 525 531 526 $picture[$i]['thumbnail'] = get_thumbnail_url($row);527 532 528 533 if ( !empty( $row['name'] ) ) … … 567 572 $picture['current']['height']= $taille_image[1]; 568 573 } 569 }570 571 if (!empty($picture['current']['width']))572 {573 list(574 $picture['current']['scaled_width'],575 $picture['current']['scaled_height']576 ) = get_picture_size(577 $picture['current']['width'],578 $picture['current']['height'],579 @$user['maxwidth'],580 @$user['maxheight']581 );582 574 } 583 575 … … 897 889 898 890 // size in pixels 899 if ($picture['current']['is_picture'] AND $picture['current']['has_high']) 900 { 901 if (!empty($picture['current']['high_width'])) 902 { 903 $infos['INFO_DIMENSIONS'] = $picture['current']['high_width'].'*'.$picture['current']['high_height']; 904 } 905 else if ($hi_size = @getimagesize($hi_url)) 906 { 907 pwg_query(' 908 UPDATE ' . IMAGES_TABLE . ' 909 SET 910 high_width = \'' . $hi_size[0].'\', 911 high_height = \''.$hi_size[1] .'\' 912 WHERE id = ' . $picture['current']['id'] . '; 913 '); 914 915 $infos['INFO_DIMENSIONS'] = $hi_size[0].'*'.$hi_size[1]; 916 } 917 } 918 else if ($picture['current']['is_picture'] and isset($picture['current']['width']) ) 919 { 920 if ($picture['current']['scaled_width'] !== $picture['current']['width'] ) 921 { 922 $infos['INFO_DIMENSIONS'] = 923 '<a href="'.$picture['current']['image_url'].'" title="'. 924 l10n('Original dimensions').'">'. 925 $picture['current']['width'].'*'.$picture['current']['height'].'</a>'; 926 } 927 else 928 { 929 $infos['INFO_DIMENSIONS'] = 930 $picture['current']['width'].'*'.$picture['current']['height']; 931 } 891 if ($picture['current']['is_picture'] and isset($picture['current']['width']) ) 892 { 893 $infos['INFO_DIMENSIONS'] = 894 $picture['current']['width'].'*'.$picture['current']['height']; 932 895 } 933 896 934 897 // filesize 935 if ($picture['current']['has_high'] and !empty($picture['current']['high_filesize'])) 936 { 937 $infos['INFO_FILESIZE'] = 938 sprintf(l10n('%d Kb'), $picture['current']['high_filesize']); 939 } 940 else if (!empty($picture['current']['filesize'])) 898 if (!empty($picture['current']['filesize'])) 941 899 { 942 900 $infos['INFO_FILESIZE'] = -
trunk/themes/default/template/picture_content.tpl
r11062 r12796 1 {if isset($high)} 2 {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} 3 <a href="javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"> 1 <img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()} alt="{$ALT_IMG}" id="theMainImage" 2 {if isset($COMMENT_IMG)} 3 title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}" 4 {/if}> 5 {if count($current.available_derivative_types)>1} 6 {footer_script}{literal} 7 function changeImgSrc(url,type) 8 { 9 var theImg = document.getElementById("theMainImage"); 10 if (theImg) 11 { 12 theImg.removeAttribute("width");theImg.removeAttribute("height"); 13 theImg.src = url; 14 } 15 document.cookie = 'picture_deriv=' + type; 16 } 17 {/literal}{/footer_script} 18 <p> 19 {foreach from=$current.available_derivative_types item=derivative_type} 20 <a onclick="changeImgSrc('{$current.derivatives[$derivative_type]->get_url()|@escape:javascript}', '{$derivative_type}')" title="{$current.derivatives[$derivative_type]->get_size_hr()}">{$derivative_type}</a> 21 {/foreach} 22 </p> 4 23 {/if} 5 <img src="{$SRC_IMG}" style="width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;" alt="{$ALT_IMG}" id="theMainImage"6 {if isset($COMMENT_IMG)}7 title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}"8 {/if}>9 {if isset($high) }10 </a>11 <p>{'Click on the photo to see it in high definition'|@translate}</p>12 {/if}
![(please configure the [header_logo] section in trac.ini)](http://piwigo.org/screenshots/piwigo_logo_on_white.png)