Changeset 12797 for trunk/picture.php
- Timestamp:
- Dec 27, 2011, 9:26:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r12796 r12797 475 475 $i = 'previous'; 476 476 } 477 else 477 elseif (isset($page['next_item']) and $row['id'] == $page['next_item']) 478 478 { 479 479 $i = 'next'; 480 480 } 481 else 481 elseif (isset($page['first_item']) and $row['id'] == $page['first_item']) 482 482 { 483 483 $i = 'first'; 484 484 } 485 else 485 elseif (isset($page['last_item']) and $row['id'] == $page['last_item']) 486 486 { 487 487 $i = 'last'; … … 492 492 } 493 493 494 $picture[$i] = $row; 495 496 $picture[$i]['is_picture'] = false; 497 if (in_array(get_extension($row['file']), $conf['picture_ext'])) 498 { 499 $picture[$i]['is_picture'] = true; 500 } 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(); 494 495 496 $row['derivatives'] = DerivativeImage::get_all($row); 497 $row['src_image'] = $row['derivatives'][IMG_THUMB]->src_image; 505 498 506 499 // ------ build element_path and element_url 507 $picture[$i]['element_path'] = get_element_path($picture[$i]); 508 $picture[$i]['element_url'] = get_element_url($picture[$i]); 509 510 // ------ build image_path and image_url 511 if ($i=='current' or $i=='next') 512 { 513 $picture[$i]['image_path'] = get_image_path( $picture[$i] ); 514 $picture[$i]['image_url'] = get_image_url( $picture[$i] ); 515 } 500 $row['element_path'] = get_element_path($row); 501 $row['element_url'] = get_element_url($row); 516 502 517 503 if ($i=='current') 518 504 { 519 if ( $ picture[$i]['is_picture'])505 if ( $row['src_image']->is_original() ) 520 506 { 521 507 if ( $user['enabled_high']=='true' ) 522 508 { 523 $ picture[$i]['download_url'] = get_download_url('e',$picture[$i]);509 $row['download_url'] = get_download_url('e',$row); 524 510 } 525 511 } 526 512 else 527 513 { // not a pic - need download link 528 $picture[$i]['download_url'] = get_download_url('e',$picture[$i]); 529 } 530 } 531 532 533 if ( !empty( $row['name'] ) ) 534 { 535 $picture[$i]['name'] = $row['name']; 536 } 537 else 538 { 539 $file_wo_ext = get_filename_wo_extension($row['file']); 540 $picture[$i]['name'] = str_replace('_', ' ', $file_wo_ext); 541 } 542 543 $picture[$i]['name'] = trigger_event('render_element_description', $picture[$i]['name']); 544 545 $picture[$i]['url'] = duplicate_picture_url( 514 $row['download_url'] = $row['element_url']; 515 } 516 } 517 518 $row['url'] = duplicate_picture_url( 546 519 array( 547 520 'image_id' => $row['id'], … … 553 526 ); 554 527 528 $picture[$i] = $row; 529 530 if ( !empty( $row['name'] ) ) 531 { 532 $picture[$i]['name'] = $row['name']; 533 } 534 else 535 { 536 $file_wo_ext = get_filename_wo_extension($row['file']); 537 $picture[$i]['name'] = str_replace('_', ' ', $file_wo_ext); 538 } 539 540 $picture[$i]['name'] = trigger_event('render_element_description', $picture[$i]['name']); 541 555 542 if ('previous'==$i and $page['previous_item']==$page['first_item']) 556 543 { … … 560 547 { 561 548 $picture['last'] = $picture[$i]; 562 }563 }564 565 // calculation of width and height for the current picture566 if (empty($picture['current']['width']))567 {568 $taille_image = @getimagesize($picture['current']['image_path']);569 if ($taille_image!==false)570 {571 $picture['current']['width'] = $taille_image[0];572 $picture['current']['height']= $taille_image[1];573 549 } 574 550 } … … 638 614 ( 639 615 ($conf['show_exif'] or $conf['show_iptc']) 640 and isset($picture['current']['image_path'])616 and !$picture['current']['src_image']->is_mimetype() 641 617 ), 642 $picture['current'] ['path']618 $picture['current'] 643 619 ); 644 620 … … 653 629 // allow plugins to change what we computed before passing data to template 654 630 $picture = trigger_event('picture_pictures_data', $picture); 655 656 657 if (isset($picture['next']['image_url'])658 and $picture['next']['is_picture']659 and strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome/') === false)660 {661 $template->assign('U_PREFETCH', $picture['next']['image_url'] );662 }663 631 664 632 //------------------------------------------------------- navigation management … … 673 641 array( 674 642 'TITLE' => $picture[$which_image]['name'], 675 'THUMB_SRC' => $picture[$which_image][' thumbnail'],643 'THUMB_SRC' => $picture[$which_image]['derivatives'][IMG_THUMB]->get_url(), 676 644 // Params slideshow was transmit to navigation buttons 677 645 'U_IMG' => … … 889 857 890 858 // size in pixels 891 if ($picture['current'][' is_picture']and isset($picture['current']['width']) )859 if ($picture['current']['src_image']->is_original() and isset($picture['current']['width']) ) 892 860 { 893 861 $infos['INFO_DIMENSIONS'] = … … 981 949 $template->assign( 'ELEMENT_CONTENT', $element_content ); 982 950 951 if (isset($picture['next']) 952 and $picture['next']['src_image']->is_original() 953 and strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome/') === false) 954 { 955 $template->assign('U_PREFETCH', $picture['next']['derivatives'][pwg_get_session_var('picture_deriv', IMG_LARGE)]->get_url() ); 956 } 957 958 983 959 // +-----------------------------------------------------------------------+ 984 960 // | sub pages |
Note: See TracChangeset
for help on using the changeset viewer.