Changeset 12855 for trunk/include/functions_picture.inc.php
- Timestamp:
- Jan 5, 2012, 11:06:21 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 /*
Note: See TracChangeset
for help on using the changeset viewer.