From 3b82a74e299ae31de991dc50f0b223e90d0dc670 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 11 Feb 2008 09:02:44 +0000 Subject: [PATCH] Blow out mem limit, slightly larger thumbnails. git-svn-id: http://svn.automattic.com/wordpress/trunk@6786 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 9 +++++---- wp-includes/functions.php | 4 ++-- wp-includes/shortcodes.php | 4 +--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index c8bd20002..5704f462e 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -40,7 +40,7 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { imagesavealpha( $thumbnail, true); } - @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight ); + imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $sourceImageWidth, $sourceImageHeight ); imagedestroy( $image ); // Free up memory @@ -153,9 +153,8 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { $max = apply_filters( 'wp_thumbnail_creation_size_limit', absint( WP_MEMORY_LIMIT ) * 1024 * 1024, $attachment_id, $file ); if ( $max < 0 || $metadata['width'] * $metadata['height'] < $max ) { - $max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file ); + $max_side = apply_filters( 'wp_thumbnail_max_side_length', 140, $attachment_id, $file ); $thumb = wp_create_thumbnail( $file, $max_side ); - if ( @file_exists($thumb) ) $metadata['thumb'] = basename($thumb); } @@ -188,7 +187,9 @@ function wp_load_image( $file ) { if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); - $image = @imagecreatefromstring( @file_get_contents( $file ) ); + // Set artificially high because GD uses uncompressed images in memory + @ini_set('memory_limit', '256M'); + $image = imagecreatefromstring( file_get_contents( $file ) ); if ( !is_resource( $image ) ) return sprintf(__("File '%s' is not an image."), $file); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 05e072009..e5a37e5d0 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1070,7 +1070,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) // separate the filename into a name and extension $info = pathinfo($filename); - $ext = strtolower( $info['extension'] ); + $ext = $info['extension']; $name = basename($filename, ".{$ext}"); // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. @@ -1083,7 +1083,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) if ( empty( $ext) ) $ext = ''; else - $ext = ".$ext"; + $ext = strtolower( ".$ext" ); $filename = $filename . $ext; while ( file_exists( $dir . "/$filename" ) ) { if ( '' == "$number$ext" ) diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 2d43552c3..32740a60f 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -146,8 +146,6 @@ function gallery_shortcode($attr) { $output = "