Instant Image Resizer
Had enough thumbnails to last you your eternal lifetime? Fine, just use Instant Image Resize to take one image and re-size(with or without cropping) to whatever size you desire.
Below is an example where we take an image that we have loaded into a custom field, and we will use the Instant Image Resize to re-size it to our required 100×100 size(note we are already in a loop and assuming a custom field called “image” is set to a relative path of an image):
<img src="<?php echo em_resize(get_post_meta($post->ID, 'image', true), 100, 100 ); ?>" />
From here, the plugin will automatically create a cached version of the scaled image(you can force a new one), easing the load on the server and preventing you from wasting valuable time doing it manually in Photoshop(or Gimp if you’re an open source kind of fella).
Below are the parameters available when calling em_resize:
em_resize( $src, $width, $height = 'auto', $quality = 95, $crop=true, $fill=NULL, $force=false ) $src The source image to rescale(doesn't affect the image) $width The maximum width of the image to scale to (int or 'auto') $height The maximum height of the image to scale to (int or 'auto') $quality The JPEG quality of the rescaled image(default 95%) $crop Crop to fit the exact dimensions(if using both width and height) $fill !!DEPRECATED!! This has been removed. Use CSS instead. $force Force the image to be recreated(destroys the cached version)
Note: The plugin will create a _cache folder within the same folder as the image being scaled to store cached images. In other words, the folder must be writable.