WordPress.org

Make WordPress Core

Ticket #14106: demo-plugin.php

File demo-plugin.php, 351 bytes (added by nkuttler, 4 years ago)

Small demo how the new filters can be used to post-process post thumbnails from a plugin/theme

Line 
1<?php
2add_image_size( 'mythumb_bw', 200, 50, true );
3add_image_size( 'mythumb', 200, 50, true );
4add_filter( 'image_resize_mythumb_bw', 'bw' );
5function bw( $image ) {
6        imagefilter( $image, IMG_FILTER_GRAYSCALE );
7        return $image;
8}
9add_filter( 'image_resize_suffix_mythumb_bw', 'bwfilename' );
10function bwfilename( $suffix ) {
11        return "$suffix-bw";
12}