Changeset 12855 for trunk/include
- Timestamp:
- Jan 5, 2012, 11:06:21 PM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative.inc.php
r12831 r12855 139 139 } 140 140 141 static function get_all($infos) 142 { 143 $src_image = new SrcImage($infos); 141 static function get_all($src_image) 142 { 144 143 $ret = array(); 145 144 foreach (ImageStdParams::get_defined_type_map() as $type => $params) -
trunk/include/functions.inc.php
r12831 r12855 741 741 } 742 742 743 /** 744 * @param element_info array containing element information from db; 745 * at least 'id', 'path' should be present 746 */ 747 function get_element_path($element_info) 748 { 749 $path = $element_info['path']; 750 if ( !url_is_remote($path) ) 751 { 752 $path = PHPWG_ROOT_PATH.$path; 753 } 754 return $path; 755 } 756 743 757 744 758 /* Returns the PATH to the thumbnail to be displayed. If the element does not -
trunk/include/functions_picture.inc.php
r9366 r12855 22 22 // +-----------------------------------------------------------------------+ 23 23 24 /**25 * @param element_info array containing element information from db;26 * at least 'id', 'path' should be present27 */28 function get_element_path($element_info)29 {30 $path = get_element_location($element_info);31 if ( !url_is_remote($path) )32 {33 $path = PHPWG_ROOT_PATH.$path;34 }35 return $path;36 }37 38 /*39 * @param element_info array containing element information from db;40 * at least 'id', 'path' should be present41 */42 function get_element_url($element_info)43 {44 $url = get_element_location($element_info);45 if ( !url_is_remote($url) )46 {47 $url = embellish_url(get_root_url().$url);48 }49 // plugins want another url ?50 return trigger_event('get_element_url', $url, $element_info);51 }52 53 /**54 * Returns the relative path of the element with regards to to the root55 * of PWG (not the current page). This function is not intended to be56 * called directly from code.57 * @param element_info array containing element information from db;58 * at least 'id', 'path' should be present59 */60 function get_element_location($element_info)61 {62 // maybe a cached watermark ?63 return trigger_event('get_element_location',64 $element_info['path'], $element_info);65 }66 24 67 25 … … 84 42 } 85 43 86 87 /**88 * Returns the PATH to the image to be displayed in the picture page. If the89 * element is not a picture, then the representative image or the default90 * mime image. The path can be used in the php script, but not sent to the91 * browser.92 * @param element_info array containing element information from db;93 * at least 'id', 'path', 'representative_ext' should be present94 */95 function get_image_path($element_info)96 {97 global $conf;98 $ext = get_extension($element_info['path']);99 if (in_array($ext, $conf['picture_ext']))100 {101 if (isset($element_info['element_path']) )102 {103 return $element_info['element_path'];104 }105 return get_element_path($element_info);106 }107 108 $path = get_image_location($element_info);109 if ( !url_is_remote($path) )110 {111 $path = PHPWG_ROOT_PATH.$path;112 }113 return $path;114 }115 116 /**117 * Returns the URL of the image to be displayed in the picture page. If the118 * element is not a picture, then the representative image or the default119 * mime image. The URL can't be used in the php script, but can be sent to the120 * browser.121 * @param element_info array containing element information from db;122 * at least 'id', 'path', 'representative_ext' should be present123 */124 function get_image_url($element_info)125 {126 global $conf;127 $ext = get_extension($element_info['path']);128 if (in_array($ext, $conf['picture_ext']))129 {130 if (isset($element_info['element_url']) )131 {132 return $element_info['element_url'];133 }134 return get_element_url($element_info);135 }136 137 $url = get_image_location($element_info);138 if ( !url_is_remote($url) )139 {140 $url = embellish_url(get_root_url().$url);141 }142 return $url;143 }144 145 /**146 * Returns the relative path of the image (element/representative/mimetype)147 * with regards to the root of PWG (not the current page). This function148 * is not intended to be called directly from code.149 * @param element_info array containing element information from db;150 * at least 'id', 'path', 'representative_ext' should be present151 */152 function get_image_location($element_info)153 {154 if (isset($element_info['representative_ext'])155 and $element_info['representative_ext'] != '')156 {157 $pi = pathinfo($element_info['path']);158 $file_wo_ext = get_filename_wo_extension($pi['basename']);159 $path =160 $pi['dirname'].'/pwg_representative/'161 .$file_wo_ext.'.'.$element_info['representative_ext'];162 }163 else164 {165 $ext = get_extension($element_info['path']);166 $path = get_themeconf('mime_icon_dir');167 $path.= strtolower($ext).'.png';168 if ( !file_exists(PHPWG_ROOT_PATH.$path)169 and !empty($element_info['tn_ext']) )170 {171 $path = get_thumbnail_location($element_info);172 }173 }174 175 // plugins want another location ?176 return trigger_event( 'get_image_location', $path, $element_info);177 }178 179 180 44 /* 181 45 * @param element_info array containing element information from db; … … 223 87 224 88 225 /**226 * @param what_part string one of 't' (thumbnail), 'e' (element), 'i' (image),227 * 'h' (high resolution image)228 * @param element_info array containing element information from db;229 * at least 'id', 'path' should be present230 */231 function get_download_url($what_part, $element_info)232 {233 $url = get_root_url().'action.php';234 $url = add_url_params($url,235 array(236 'id' => $element_info['id'],237 'part' => $what_part,238 )239 );240 return trigger_event( 'get_download_url', $url, $element_info);241 }242 89 243 90 /* -
trunk/include/functions_url.inc.php
r11831 r12855 661 661 } 662 662 663 664 /** 665 * @param id image id 666 * @param what_part string one of 'e' (element), 'r' (representative) 667 */ 668 function get_action_url($id, $what_part, $download) 669 { 670 $params = array( 671 'id' => $id, 672 'part' => $what_part, 673 ); 674 if ($download) 675 { 676 $params['download'] = null; 677 } 678 679 return add_url_params(get_root_url().'action.php', $params); 680 } 681 682 /* 683 * @param element_info array containing element information from db; 684 * at least 'id', 'path' should be present 685 */ 686 function get_element_url($element_info) 687 { 688 $url = $element_info['path']; 689 if ( !url_is_remote($url) ) 690 { 691 $url = embellish_url(get_root_url().$url); 692 } 693 return $url; 694 } 695 696 663 697 /** 664 698 * Indicate to build url with full path -
trunk/include/ws_functions.inc.php
r12831 r12855 148 148 { 149 149 $ret = array(); 150 151 $src_image = new SrcImage($image_row); 152 150 153 global $user; 151 154 if ($user['enabled_high']) … … 154 157 } 155 158 156 $derivatives = DerivativeImage::get_all($ image_row);159 $derivatives = DerivativeImage::get_all($src_image); 157 160 $derivatives_arr = array(); 158 161 foreach($derivatives as $type=>$derivative)
Note: See TracChangeset
for help on using the changeset viewer.