'', 'height' => '', 'crop' => FALSE ); if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes else $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes else $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) $sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] ); // For theme-added sizes else $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options } foreach ($sizes as $size => $size_data ) { $resized = hack_image_make_intermediate_size( $file, $size_data['width'], $size_data['height'], $size_data['crop'], $size ); if ( $resized ) $metadata['sizes'][$size] = $resized; } // fetch additional metadata from exif/iptc $image_meta = wp_read_image_metadata( $file ); if ( $image_meta ) $metadata['image_meta'] = $image_meta; } return $metadata; } function hack_image_make_intermediate_size( $file, $width, $height, $crop = false, $size = "" ) { if ( $width || $height ) { if ($size == "thumbnail" || $size == "medium" || $size == "large") { $suffix = $size; } else { global $_wp_additional_image_sizes; if (isset($_wp_additional_image_sizes[$size])) { $suffix = $size; } else { $suffix = null; } } //コアファイルを触らずにサムネイル(jpg)のクオリティ値を変えられます。デフォルトは90。 $resized_file = image_resize( $file, $width, $height, $crop, $suffix, null, 90 ); if ( !is_wp_error( $resized_file ) && $resized_file && $info = getimagesize( $resized_file ) ) { $resized_file = apply_filters('image_make_intermediate_size', $resized_file); return array( 'file' => wp_basename( $resized_file ), 'width' => $info[0], 'height' => $info[1], 'size' => $size ); } } return false; } ?>