WordPress plugin intelligence profile

Klan1 Common WP Functions

Basic functions needed by our others plugins and templates.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 4.2
Current version0.5
WordPress coverageTested up to WordPress 4.2
Minimum stackWP 2.7 · PHP —
Directory statusactive
Last directory update12 Aug 201511y ago
Active installations10Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Klan1 Common WP Functions version 0.5 as active, updated 11y ago and tested up to WordPress 4.2.

Overview

About this plugin

This functions are for those needs to resize images on their templates or plugins all the time.

FUNCTION: k1_get_post_thumb_url

DESCRIPTION

string k1_get_post_thumb_url(int $post_id)

This function return the URL for the FEATURED IMAGE (full sized) defined in a POST/PAGE even if the upload is no on the actual post. If is not defined returns the FIRST image if there is at least one.

Returns NULL if no jpg,png or gif images as attachments.

USAGE EXAMPLE

>

PARAMETERS

  • $post_id If is empty, we will try to get the POST ID from the global $post var

FUNCTION: k1_get_post_timthumb_img_url

DESCRIPTION

string k1_get_post_timthumb_img_url(int $post_id, int $width, int $height, int $crop, char $align, int $quality)

Returns the IMAGE full URL using timthumb script to resize the post featured image. Use this when you only need the URL not the IMG html tag.

USAGE EXAMPLE

>

PARAMETERS

  • $post_id If is empty, we will try to get the POST ID from the global $post var
  • $width This is numeric in pixels, if you use 0 width will be proportional to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
  • $height This is numeric in pixels, if you use 0 height will be proportional to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
  • $crop Use: 0 Resize to Fit specified dimensions (no cropping), 1 Crop and resize to best fit the dimensions (default), 2 Resize proportionally to fit entire image into specified dimensions, and add borders if required, 3 Resize proportionally adjusting size of scaled image so there are no borders gaps, see: http://www.binarymoon.co.uk/demo/timthumb-zoom-crop/
  • $align c: position in the center (this is the default), t: align top, tr: align top right, tl: align top left, b: align bottom, br: align bottom right, bl: align bottom left, l: align left, r: align rightSee: http://www.binarymoon.co.uk/2010/08/timthumb-part-4-moving-crop-location/
  • $quality 70: Image quality from the original uploaded image in percentage

NOTE: If you just define one height or width as zero (0) the other one will conserve image proportion, if is not defined it will be default value.

FUNCTION: k1_get_post_thumb_img_html

DESCRIPTION

string k1_get_post_thumb_img_html(int $post_id, boolean $resize, int $width, int $height, int $crop, char $align, int $quality)

This function returns the FULL IMG HTML tag for the post featured image using TIMTHUMB or not as desired

USAGE EXAMPLE

>

PARAMETERS

  • $post_id If is empty, we will try to get the POST ID from the global $post var
  • $resize TRUE to use timthumb script to resize the image, FALSE to return the image without any dimension change.
  • $width This is numeric in pixels, if you use 0 width will be proportional to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
  • $height This is numeric in pixels, if you use 0 height will be proportional to height. See: http://www.binarymoon.co.uk/demo/timthumb-basic/
  • $crop Use: 0 Resize to Fit specified dimensions (no cropping), 1 Crop and resize to best fit the dimensions (default), 2 Resize proportionally to fit entire image into specified dimensions, and add borders if required, 3 Resize proportionally adjusting size of scaled image so there are no borders gaps, see: http://www.binarymoon.co.uk/demo/timthumb-zoom-crop/
  • $align c: position in the center (this is the default), t: align top, tr: align top right, tl: align top left, b: align bottom, br: align bottom right, bl: align bottom left, l: align left, r: align rightSee: http://www.binarymoon.co.uk/2010/08/timthumb-part-4-moving-crop-location/
  • $quality 70: Image quality from the original uploaded image in percentage

NOTE: If you just define one height or width as zero (0) the other one will conserve image proportion, if is not defined it will be default value.

TODO:

  • Get the attachment metadata to make the longdesc=”” and alt=”” IMG properties.
  • Use the parameters as array to implement more options
WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • basic functions
  • image resize
  • developer
  • klan1
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 4.2

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 4.2.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to4.2
Minimum requirementsWordPress 2.7 · PHP not listed
Update activity12 Aug 201511y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.