Blow out mem limit, slightly larger thumbnails.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-02-11 09:02:44 +00:00
parent a39ee17da9
commit 3b82a74e29
3 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,7 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
imagesavealpha( $thumbnail, true); 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 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 ); $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 ) { 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 ); $thumb = wp_create_thumbnail( $file, $max_side );
if ( @file_exists($thumb) ) if ( @file_exists($thumb) )
$metadata['thumb'] = basename($thumb); $metadata['thumb'] = basename($thumb);
} }
@ -188,7 +187,9 @@ function wp_load_image( $file ) {
if ( ! function_exists('imagecreatefromstring') ) if ( ! function_exists('imagecreatefromstring') )
return __('The GD image library is not installed.'); 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 ) ) if ( !is_resource( $image ) )
return sprintf(__("File '%s' is not an image."), $file); return sprintf(__("File '%s' is not an image."), $file);

View File

@ -1070,7 +1070,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL )
// separate the filename into a name and extension // separate the filename into a name and extension
$info = pathinfo($filename); $info = pathinfo($filename);
$ext = strtolower( $info['extension'] ); $ext = $info['extension'];
$name = basename($filename, ".{$ext}"); $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. // 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) ) if ( empty( $ext) )
$ext = ''; $ext = '';
else else
$ext = ".$ext"; $ext = strtolower( ".$ext" );
$filename = $filename . $ext; $filename = $filename . $ext;
while ( file_exists( $dir . "/$filename" ) ) { while ( file_exists( $dir . "/$filename" ) ) {
if ( '' == "$number$ext" ) if ( '' == "$number$ext" )

View File

@ -146,8 +146,6 @@ function gallery_shortcode($attr) {
$output = " $output = "
<style type='text/css'> <style type='text/css'>
.gallery { .gallery {
width: 450px;
left: 50%;
margin: auto; margin: auto;
} }
.gallery div { .gallery div {
@ -156,7 +154,7 @@ function gallery_shortcode($attr) {
text-align: center; text-align: center;
width: 33%; } width: 33%; }
.gallery img { .gallery img {
border: 3px solid #cfcfcf; border: 2px solid #cfcfcf;
} }
</style> </style>
<div class='gallery'> <div class='gallery'>