johannesress
1/27/2014 - 12:13 PM

Create a greyscaled version of your thumbnails on upload

Create a greyscaled version of your thumbnails on upload

<?php the_post_thumbnail( 'width=300&height=200&crop=1&greyscale=1' ); ?>
<?php
// Das Plugin WPTHumb von folgender URL muss installiert sein! https://github.com/humanmade/WPThumb

add_filter( 'wpthumb_image_post', function( WP_Image_Editor $editor, $args ) {
    if ( ! is_a( $editor, 'WP_Image_Editor_GD' ) || empty( $args['greyscale'] ) )
        return $editor;

    imagefilter( $editor->get_image(), IMG_FILTER_GRAYSCALE );
    return $editor;
}, 10, 2 );
?>