Easy WP Thumbs

PHP Script

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 WordPress 3.5 and PHP 5.2
Supports WP_Image_Editor class, using Imagick where available.

Currently you can see this script implemented 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:
SCRIPT-URL/easy_wp_thumbs.php?src= &w= &h= &q= &a= &rs= &cc= &fx=

  Parameters

ParameterDefault ValueDescription
$img_src / src//Image source. Could be the WP image ID or the image path/url
(required)
$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 / fxnone

Effects applied to the image

  • 1 = grayscale
  • 2 = blur

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

lcwebEasy WP Thumbs – PHP script