Horje
How to Resize Sharpen Images (only JPEG)

This function sharpens resized JPEG images. An example of a difference:


Sharpen Resized Images (only JPEG)

Just copy and past following codes to yourdomain.com/wp-content/themes/activated-theme/fucntions.php in the most below.
Example: PHP
function ajx_sharpen_resized_files( $resized_file ) {

    $image = wp_load_image( $resized_file );
    if ( !is_resource( $image ) )
        return new WP_Error( 'error_loading_image', $image, $file );

    $size = @getimagesize( $resized_file );
    if ( !$size )
        return new WP_Error('invalid_image', __('Could not read image size'), $file);
    list($orig_w, $orig_h, $orig_type) = $size;

    switch ( $orig_type ) {

        case IMAGETYPE_JPEG:
            $matrix = array(
                array(-1, -1, -1),
                array(-1, 16, -1),
                array(-1, -1, -1),
            );

            $divisor = array_sum(array_map('array_sum', $matrix));
            $offset = 0;
            imageconvolution($image, $matrix, $divisor, $offset);
            imagejpeg($image, $resized_file,apply_filters( 'jpeg_quality', 90, 'edit_image' ));
            break;

        case IMAGETYPE_PNG:
            return $resized_file;

        case IMAGETYPE_GIF:
            return $resized_file;
    }

    return $resized_file;
}

add_filter('image_make_intermediate_size', 'ajx_sharpen_resized_files', 900);





Related Articles
How to Resize Sharpen Images (only JPEG) Wordpress Image Shortcode
How to Extract Auto the First Image from the Post Content Wordpress Image Shortcode

Single Articles
Sharpen Resized Images (only JPEG)Wordpress Image Shortcode

Read Full:
Wordpress Image Shortcode
Category:
Web Tutorial
Sub Category:
Wordpress Image Shortcode
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
36
Tested on:
WordPress 3.0.1



Share on: