Changeset 13860 for trunk/wp-admin/includes/image.php
- Timestamp:
- 03/28/2010 03:39:00 AM (14 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.