Changeset 13860
- Timestamp:
- 03/28/2010 03:39:00 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/image.php
r13249 r13860 136 136 137 137 return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id ); 138 }139 140 /**141 * Load an image from a string, if PHP supports it.142 *143 * @since 2.1.0144 *145 * @param string $file Filename of the image to load.146 * @return resource The resulting image resource on success, Error string on failure.147 */148 function wp_load_image( $file ) {149 if ( is_numeric( $file ) )150 $file = get_attached_file( $file );151 152 if ( ! file_exists( $file ) )153 return sprintf(__('File “%s” doesn’t exist?'), $file);154 155 if ( ! function_exists('imagecreatefromstring') )156 return __('The GD image library is not installed.');157 158 // Set artificially high because GD uses uncompressed images in memory159 @ini_set('memory_limit', '256M');160 $image = imagecreatefromstring( file_get_contents( $file ) );161 162 if ( !is_resource( $image ) )163 return sprintf(__('File “%s” is not an image.'), $file);164 165 return $image;166 138 } 167 139 -
trunk/wp-includes/media.php
r13857 r13860 229 229 230 230 return $html; 231 } 232 233 /** 234 * Load an image from a string, if PHP supports it. 235 * 236 * @since 2.1.0 237 * 238 * @param string $file Filename of the image to load. 239 * @return resource The resulting image resource on success, Error string on failure. 240 */ 241 function wp_load_image( $file ) { 242 if ( is_numeric( $file ) ) 243 $file = get_attached_file( $file ); 244 245 if ( ! file_exists( $file ) ) 246 return sprintf(__('File “%s” doesn’t exist?'), $file); 247 248 if ( ! function_exists('imagecreatefromstring') ) 249 return __('The GD image library is not installed.'); 250 251 // Set artificially high because GD uses uncompressed images in memory 252 @ini_set('memory_limit', '256M'); 253 $image = imagecreatefromstring( file_get_contents( $file ) ); 254 255 if ( !is_resource( $image ) ) 256 return sprintf(__('File “%s” is not an image.'), $file); 257 258 return $image; 231 259 } 232 260
Note: See TracChangeset
for help on using the changeset viewer.