What is this?

Easy WP Thumbs is a PHP script created with the purpose to make thumbnails creation process as easy and smooth as possible. Inspired by TimThumb, is deeply integrated into WordPress.

Requires at least WP 3.5 and PHP 5.2
Supports WP 3.5 WP_Image_Editor class, using Imagick where available

The script is currently used in Media Grid and Global Gallery

How to use

  1. include the script in main plugin/theme file
  2. place the “ewpt_wpf_form()” function in an admin page to let users check script status and, eventually, insert FTP/SSH credentials
  3. create thumbnail URL using “easy_wp_thumb()” function or calling the script directly

Function usage: (must be used within wordpress)

<?php echo easy_wp_thumb($img_src, $width, $height, $quality, $alignment, $resize, $canvas_col, $fx); ?>
HTTP usage:
http://PATH_TO_SCRIPT/easy_wp_thumbs.php?src= &w= &h= &q= &a= &rs= &cc= &fx=


ParameterDefault ValueDescription
$img_src / src//Image source. Could be the WP image ID or the image path/url
$width / wImage’s widthThumbnail’s width
$height / hImage’s heightThumbnail’s height
$quality / q80Thumbnail’s quality in a scale of 0-100
$alignment / acCrop alignment. Possible values: tl, t, tr, l, c, r, bl, b, br
c = center, t = top, b = bottom, r = right, l = left
$resize / rs1Resize method
1 = Resize and crop
2 = Resize and add borders
3 = Only resize
$canvas_col / ccFFFFFFBackground / borders color – use hexadecimal values
$fx / fxnoneEffects applied to the image

  • 1 = grayscale
  • 2 = blur

Must be used with commas. Ex: $fx = 1,2,2,2

Sizing tips

  • If both width and height are not specified, image will have original sizes and recreated with different quality and/or effects
  • If only one of them is missing, other will be auto-calculated maintaining image proportions

Enjoyed this freebie and want to show some appreciation?

Offer me a cofee or two to continue coding!

lcwebEasy WP Thumbs – PHP script