Step 1:
Define two custom image sizes, e.g.:
<?php
add_image_size( 'normal-thumbnail', 400, 300, false ); // Default image size
add_image_size( 'mobile-device-thumbnail', 200, 150, false ); // Mobile-device image size
?>
Step 2:
Implement your chosen means to determine client. There are several ways, and which method you use is outside the scope of this question. But, assuming you have a method that works for you, output the result to some variable, such as $mobile_device = true;
Step 3:
In your template files, output the image conditionally, based on client.
<?php
if ( true = $mobile_device ) { // client is mobile; be responsive
the_post_thumbnail( 'mobile-device-thumbnail' );
} else {
the_post_thumbnail( 'normal-thumbnail' );
}
?>
Note: you could repeat the if/else
(or do a switch
) for multiple form factors (i.e. screen sizes). Just add multiple custom image sizes, and conditionally test for each screen size you want to support.