Get the Image is one of the most advanced thumbnail/image scripts ever created for WordPress.
It is used everywhere from small blogs to large, enterprise-level solutions like WordPress.com VIP. Get the Image offers something for everybody. Much of the reason for its success is because it uses standard WordPress code and methods for doing what it needs to do, which is to simply grab images.
The plugin was designed to make the process of adding thumbnail, featured, slider, gallery, and other images to your blog much easier, but it’s so much more than that. It is an image-based representation of your WordPress posts.
This is a highly intuitive script that can grab an image by custom field input, WordPress’ featured image, post attachment, or extracting it from the post’s content. Plus, a lot more!
A little history
The original plugin was in launched 2008, which means it has several years of solid testing and development behind it. It was created at a time when WordPress had very little native media support. At the time, it was mostly used as a “thumbnail” script for magazine-/news-style sites. But, it has grown into a much more flexible script over the years.
Even with WordPress’ more recent advancements in image management, many users still continue using this plugin because it offers a more robust image script than core WordPress.
The plugin has been downloaded 100,000s of times and is used on millions of sites as part of WordPress theme packages.
Other image plugins have come and gone, but Get the Image has stood the test of time with several years of successful installs and happy users.
If you need professional plugin support from me, the plugin author, you can access the support forums at Theme Hybrid, which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing).
If you’re a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on its GitHub repository.
Yes, I do accept donations. If you want to buy me a beer or whatever, you can do so from my donations page. I appreciate all donations, no matter the size. Further development of this plugin is not contingent on donations, but they are always a nice incentive.
- Why was this plugin created?
It was originally created to work with magazine/news themes. These types of themes typically required a lot of work when inputting images to make them look good. This plugin was developed to make that process much easier for the end user. But, at the same time, it needed to be flexible enough to handle anything.
However, over the years, it has grown to be one of the most robust image scripts for WordPress.
- How does it grab images?
- Looks for an image by custom field (one of your choosing).
- If no image is added by custom field, check for an image using
the_post_thumbnail()(WordPress featured image).
- If no image is found, it grabs an image attached to your post.
- If no image is attached, it can extract an image from your post content (off by default).
- If no image is found at this point, it will fall back to a default image (not set by default).
- How do I add it to my theme?
There are several methods, but in general, you would use this call within The Loop.
<?php if ( function_exists( 'get_the_image' ) ) get_the_image(); ?>
To see all methods and options, refer to the
readme.mdfile included with the plugin download or view it on the plugin’s GitHub page
Nice plugin, I use it for all of my sites.
- Changed priority of
split_contentfilter to make sure images are split from the content.
the_post_thumbnailargument deprecated in favor of
image_scanargument deprecated in favor of
default_imageargument deprecated in favor of
order_of_imageargument removed with no replacement.
- Re-coded how the image script works by encapsulating the functionality into a single class rather than multiple functions. This makes it much easier to reuse code and paves the way for more improvements in the future.
scan_rawargument for pulling an image (straight HTML) directly from the post content.
split_contentargument for removing an image from the post content if one is found. Used only in conjunction with the
orderargument for changing the order in which the script looks for images.
- Better support and handling for sub-attachments (e.g., featured images for audio/video attachments).
- Support for Schema.org microdata.
itemprop="image"attribute added to image outputs where possible.
- New image orientation class if the width and height are available. Class can be
- Default image size is
post-thumbnailif the theme has set this size. Otherwise,
thumbnailis the default size.
- Supports the ability to get embedded images via WordPress’ image embeds (Instagram, Flickr, etc.) via the
- New filter hook:
get_the_image_post_content. Used when checking the post content.
min_heightarguments (doesn’t work with
- Caption support. FTW!
- Multiple image classes now allowed via the
- Use current theme’s
post-thumbnailas default image size if set via
- Use the WordPress-saved attachment alt text for the image.
- Only add
$out['url']is set when returning as an array.
httpswhen returning as an array.
- Use the correct variable (
$attachment_id) when getting an image via attachment.
- Use correct
$attachment_idvariable instead of
- Pass full
$imagearray to the
get_the_image_meta_key_save()function so that it saves correctly.
- Only use
afterarguments if an image is found.
- General code formatting updated.
- Inline docs updates.
- Added the
beforeargument to output HTML before the image.
- Added the
afterargument to output HTML after the image.
- Added the
thumbnail_id_saveargument to allow the attached image to be saved as the thumbnail/featured image.
- Get the post ID via
get_the_ID()rather than the global
- Fixed debug notice with
- Moved the
*_fetch_post_thumbnail_htmlhooks into the main function and only fire them if displaying to the screen.
- Simplified the
- Completely rewrote the
- Sanitize classes with
- Deprecated and replaced functions that lacked the
- New cache delete functions that delete when a post or post meta is updated.
- Fixed notice when
- Updated the cache to save by post ID instead of a single object.
- Minor code adjustments.
- Updated inline documentation of the code.
meta_keylogic, which allows a single meta key or an array of keys to be used.
nullby default since they’re deprecated.
custom_keyin favor of
- Added the
meta_key_saveargument to allow users to save the image as a meta key/value pair.
- Added a
callbackargument to allow developers to create a custom callback function.
- Added a
cacheargument, which allows users to turn off caching.
- Added support for persistent-caching plugins.
- Switched the
sizeto be more in line with the WordPress post thumbnail arguments, but
default_sizewill still work.
- Now using
wp_kses_hair()to extract image attributes when using the
alttext will now use the attachment description if one has been given rather than the post title.
- Updated the
readme.htmlinstructions for using the plugin.
- Dropped support for older versions of WordPress. Now only compatible with 2.9+.
- Added support for
the_post_thumbnail(), which is WordPress 2.9’s new image functionality.
- New function:
- Documented more of the code, so the inline PHP doc is updated.
- Cleaned up some of the old legacy code that’s no longer needed.
- General code cleanup
- Added the
- General code cleanup.
- More efficient and logical code.
- Beefed up the inline documentation so developers can better understand the code.
- Added a GPL license.txt file.
- Fixed the default image and image scan features.
- Changed methods of calling the image script.
- Added more parameters.