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.
- Add image to the post automatically
- Speedy scan via Short Circuit Speed logic
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
- Unzip the chip-get-image.zip folder.
- Upload chip-get-image folder to your /wp-contents/plugins directory.
- Open Plugins section from your WordPress dashboard.
- 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, );
A sequence that will act as road map for plugin to find post image.
This refers to the WordPress 2.9’s new the_post_thumbnail() feature.
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).
The script will look for images attached to the post.
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 .
You can choose for the script to grab something other than the first attached image. This only refers to image attachments.
This parameter will take the input of an image URL and use it if no other images are found.
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] => https://www.tutorialchip.com/wp-content/uploads/2010/11/PHP-File-Download-Script-150x150.png [posturl] => https://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 (  => attachment  => the_post_thumbnail  => meta_key ) [the_post_thumbnail] => 1 [meta_key] => Array (  => Thumbnail  => thumbnail ) [attachment] => 1 [size] => thumbnail [attachment_order] => 1 [default_image] => ) )
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.
This parameter indicates the method which has been used to get image.
This is the url of image which is fetched by plugin.
This is the url of post, for which image has been fetched.
This parameter contains title of post which can be used in alt attribute of image tag.
This parameter helps in debugging, that what has been given as an input.
<?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> </div> <?php endif; ?> <?php endwhile; endif; ?>
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.
- chip-get-image.php – Main Plugin File
- readme.txt – Help about Chip Get Image
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
A PHP Notice has been fixed. Notice was observed when WordPress runs in WP_DEBUG true mode.
Plugin released and tested it in different dimensions at Chip Zero.