Browsing: Chip Get Image: WordPress Plugin with Speedy Logic

Chip Get Image Support at Priority

Chip Get Image is a WordPress Plugin. It is very flexible and easy to use script for adding thumbnails, featured images or other images to the blog posts.

You can beautify your blog by displaying thumbnails along with post title. Chip Get Image provides an elegant solution to do this task by using her Short Circuit Speedy Logic. It will add image to the post by searching all possible parameters like post thumbnails, attachment image, custom fields or default.

Features

  • Add image to the post automatically
  • Speedy scan via Short Circuit Speed logic

Requirements

Chip Get Image Algorithm

As Chip Get Image, finds an image for a post automatically, so this plugin follows the Short Circuit Speedy Logic to do his job. Default behavior of Short Circuit Speedy Logic is,

  • Looks for an image by custom field.
  • If image does not find, check for post image (WordPress 2.9+ feature).
  • If no image is found again, it will find image attached to the post.
  • If attempt is not successful, it will add default image to the post. (You must set default image) .

Short Circuit Speedy Logic

I have already explained the default behavior of Short Circuit Speedy Logic. You have noticed that plugin will make four steps attempt to find image (by default), but you can make it speedy by,

  • You can change the default behavior of Short Circuit Speedy Logic. It will increase the speed dramatically. For example, When you are very much sure that image will be found from attachment only, than you can tell the plugin to find it from attachment first and than for other options OR from attachment only.
  • You can skip any step for searching the image for post.
  • You can assign only one step for searching the image for post.

You have noticed that four steps logic can easily be controlled by yourself to save time and server resources.

How to install the plugin

  1. Unzip the chip-get-image.zip folder.
  2. Upload chip-get-image folder to your /wp-contents/plugins directory.
  3. Open Plugins section from your WordPress dashboard.
  4. Activate Chip Get Image

How to use the plugin

By simply making a function call to within a template file, the script will default to this:

$defaults = array(
		'post_id'				=>	$post->ID,
		'short_circuit'			=>	array( 'attachment', 'the_post_thumbnail', 'meta_key' ),
		'the_post_thumbnail'	        =>	TRUE,
		'meta_key'				=>	array( 'Thumbnail', 'thumbnail' ),
		'attachment'			=>	TRUE,
		'size'					=>	'thumbnail',
		'attachment_order'		=>	1,
		'default_image'			=>	FALSE,
	);

short_circuit

A sequence that will act as road map for plugin to find post image.

the_post_thumbnail

This refers to the WordPress 2.9′s new the_post_thumbnail() feature.

meta_key

This parameter refers to a custom field key (or keys) that you use. Remember, custom field keys are case-sensitive (defaults are Thumbnail and thumbnail).

attachment

The script will look for images attached to the post.

size

This refers to the size of an attached image. You can choose between thumbnail, medium, large, full, or any custom image size you have available .

attachment_order

You can choose for the script to grab something other than the first attached image. This only refers to image attachments.

default_image

This parameter will take the input of an image URL and use it if no other images are found.

Usage

Let’s play with default parameters.

Input: Default Parameters

 if( function_exists( "chip_get_image" ) ):
		$chip_image = chip_get_image();
		chip_get_print( $chip_image );
endif;

Output: Chip Get Image returns a comprehensive output for the flexible and easy usage.

Array
(
    [steptaken] => 1
    [method] => attachment
    [imageurl] => http://www.tutorialchip.com/wp-content/uploads/2010/11/PHP-File-Download-Script-150x150.png
    [posturl] => http://www.tutorialchip.com/php/php-file-download-script/
    [alt] => PHP File Download Script: Professional, Flexible and Free Class
    [post_thumbnail_id] =>
    [args] => Array
        (
            [post_id] => 14
            [short_circuit] => Array
                (
                    [0] => attachment
                    [1] => the_post_thumbnail
                    [2] => meta_key
                )

            [the_post_thumbnail] => 1
            [meta_key] => Array
                (
                    [0] => Thumbnail
                    [1] => thumbnail
                )

            [attachment] => 1
            [size] => thumbnail
            [attachment_order] => 1
            [default_image] =>
        )

)

Output Analysis:

steptaken

This parameter indicates the steps which are involved to get image for the post. I have used attachment parameter first as i know – my posts will contain images in attachment. This is the beauty of Short Circuit Speedy Logic.

method

This parameter indicates the method which has been used to get image.

imageurl

This is the url of image which is fetched by plugin.

posturl

This is the url of post, for which image has been fetched.

alt

This parameter contains title of post which can be used in alt attribute of image tag.

args

This parameter helps in debugging, that what has been given as an input.

Complete Implementation

<?php
if (have_posts()):
while (have_posts()) : the_post();
?>

       <?php
        if( function_exists( "chip_get_image" ) ):
		$chip_image = chip_get_image();
		/* chip_get_print( $chip_image ); */
		?>
        <a href="<?php echo $chip_image['posturl']; ?>" title="<?php echo $chip_image['alt']; ?>"><img src="<?php echo $chip_image['imageurl']; ?>" alt="<?php echo $chip_image['alt']; ?>" width="150" height="150" /></a>
        <?php
        else:
		?>
        <div>&nbsp;</div>
        <?php
        endif;
		?>
<?php
endwhile;
endif;
?>

Screenshot

Chip Zero Free WordPress Theme 3.0

Online Demo

Chip Zero which is a free premium WordPress theme designed by TutorialChip. Chip Zero theme is using Chip Get Image plugin for displaying images with posts. You may have visit Chip Zero Theme Demo for looking Chip Get Image in working. I hope you will enjoy.

Download Package

Click here to download Chip Get Image plugin from from WordPress Free Themes Directory Plugin Page. Package contains,

  • chip-get-image.php – Main Plugin File
  • readme.txt – Help about Chip Get Image

0.3

Chip Get Image plugin is updated on March 11, 2011.

  • A PHP Error has been fixed.
  • Chip Get Image compatibility to WordPress 3.1 has been ensured

0.2

A PHP Notice has been fixed. Notice was observed when WordPress runs in WP_DEBUG true mode.

0.1

Plugin released and tested it in different dimensions at Chip Zero.

email