Changeset 1596 for trunk/include/functions.inc.php
- Timestamp:
- Nov 7, 2006, 4:37:57 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r1589 r1596 682 682 683 683 /** 684 * returns thumbnail filepath (or distant URL if thumbnail is remote) for a 685 * given element 686 * 687 * the returned string can represente the filepath of the thumbnail or the 688 * filepath to the corresponding icon for non picture elements 689 * 690 * @param string path 691 * @param string tn_ext 692 * @param bool with_rewrite if true returned path can't be used from the script 693 * @return string 684 DEPRECATED use get_thumbnail_path or get_thumbnail_url 694 685 */ 695 686 function get_thumbnail_src($path, $tn_ext = '', $with_rewrite = true) 696 687 { 697 global $conf, $user; 698 699 if ($tn_ext != '') 700 { 701 $src = substr_replace( 702 get_filename_wo_extension($path), 688 if ($with_rewrite) 689 return get_thumbnail_url( array('path'=>$path, 'tn_ext'=>$tn_ext) ); 690 else 691 return get_thumbnail_path( array('path'=>$path, 'tn_ext'=>$tn_ext) ); 692 } 693 694 /* Returns the PATH to the thumbnail to be displayed. If the element does not 695 * have a thumbnail, the default mime image path is returned. The PATH can be 696 * used in the php script, but not sent to the browser. 697 * @param array element_info assoc array containing element info from db 698 * at least 'path', 'tn_ext' and 'id' should be present 699 */ 700 function get_thumbnail_path($element_info) 701 { 702 $path = get_thumbnail_location($element_info); 703 if ( !url_is_remote($path) ) 704 { 705 $path = PHPWG_ROOT_PATH.$path; 706 } 707 return $path; 708 } 709 710 /* Returns the URL of the thumbnail to be displayed. If the element does not 711 * have a thumbnail, the default mime image url is returned. The URL can be 712 * sent to the browser, but not used in the php script. 713 * @param array element_info assoc array containing element info from db 714 * at least 'path', 'tn_ext' and 'id' should be present 715 */ 716 function get_thumbnail_url($element_info) 717 { 718 $path = get_thumbnail_location($element_info); 719 if ( !url_is_remote($path) ) 720 { 721 $path = get_root_url().$path; 722 } 723 // plugins want another url ? 724 $path = trigger_event('get_thumbnail_url', $path, $element_info); 725 return $path; 726 } 727 728 /* returns the relative path of the thumnail with regards to to the root 729 of phpwebgallery (not the current page!).This function is not intended to be 730 called directly from code.*/ 731 function get_thumbnail_location($element_info) 732 { 733 global $conf; 734 if ( !empty( $element_info['tn_ext'] ) ) 735 { 736 $path = substr_replace( 737 get_filename_wo_extension($element_info['path']), 703 738 '/thumbnail/'.$conf['prefix_thumbnail'], 704 strrpos($ path,'/'),739 strrpos($element_info['path'],'/'), 705 740 1 706 741 ); 707 $src.= '.'.$tn_ext; 708 if ($with_rewrite==true and !url_is_remote($src) ) 709 { 710 $src = get_root_url().$src; 711 } 742 $path.= '.'.$element_info['tn_ext']; 712 743 } 713 744 else 714 745 { 715 $src = ($with_rewrite==true) ? get_root_url() : ''; 716 $src .= get_themeconf('mime_icon_dir'); 717 $src.= strtolower(get_extension($path)).'.png'; 718 } 719 720 return $src; 721 } 746 $path = get_themeconf('mime_icon_dir') 747 .strtolower(get_extension($element_info['path'])).'.png'; 748 } 749 750 // plugins want another location ? 751 $path = trigger_event( 'get_thumbnail_location', $path, $element_info); 752 return $path; 753 } 754 722 755 723 756 // my_error returns (or send to standard output) the message concerning the
Note: See TracChangeset
for help on using the changeset viewer.