Get the Image - Version 0.5

Version Description

Download this release

Release Info

Developer greenshady
Plugin Icon 128x128 Get the Image
Version 0.5
Comparing to
See all releases

Code changes from version 0.4 to 0.5

Files changed (3) hide show
  1. get-the-image.php +104 -46
  2. readme.html +10 -10
  3. readme.txt +10 -2
get-the-image.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Get The Image
4
  * Plugin URI: http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin
5
  * Description: This is a highly intuitive script that can grab an image by custom field input, post attachment, or extracting it from the post's content.
6
- * Version: 0.4
7
  * Author: Justin Tadlock
8
  * Author URI: http://justintadlock.com
9
  *
@@ -12,8 +12,8 @@
12
  * related to specific posts in some way. It creates an image-based representation of a WordPress
13
  * post (or any post type).
14
  *
15
- * @copyright 2008 - 2009
16
- * @version 0.4
17
  * @author Justin Tadlock
18
  * @link http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin
19
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -28,6 +28,12 @@
28
  /* Adds theme support for post images. */
29
  add_theme_support( 'post-thumbnails' );
30
 
 
 
 
 
 
 
31
  /**
32
  * This is a highly intuitive function that gets images. It first calls for custom field keys. If no
33
  * custom field key is set, check for the_post_thumbnail(). If no post image, check for images
@@ -49,7 +55,8 @@ function get_the_image( $args = array() ) {
49
  'post_id' => $post->ID,
50
  'attachment' => true,
51
  'the_post_thumbnail' => true, // WP 2.9+ image function
52
- 'default_size' => 'thumbnail',
 
53
  'default_image' => false,
54
  'order_of_image' => 1,
55
  'link_to_post' => true,
@@ -67,38 +74,71 @@ function get_the_image( $args = array() ) {
67
  /* Merge the input arguments and the defaults. */
68
  $args = wp_parse_args( $args, $defaults );
69
 
 
 
 
 
 
 
 
 
70
  /* Extract the array to allow easy use of variables. */
71
  extract( $args );
72
 
73
- /* If a custom field key (array) is defined, check for images by custom field. */
74
- if ( $custom_key )
75
- $image = image_by_custom_field( $args );
76
 
77
- /* If no image found and $the_post_thumbnail is set to true, check for a post image (WP feature). */
78
- if ( !$image && $the_post_thumbnail )
79
- $image = image_by_the_post_thumbnail( $args );
80
 
81
- /* If no image found and $attachment is set to true, check for an image by attachment. */
82
- if ( !$image && $attachment )
83
- $image = image_by_attachment( $args );
84
 
85
- /* If no image found and $image_scan is set to true, scan the post for images. */
86
- if ( !$image && $image_scan )
87
- $image = image_by_scan( $args );
88
 
89
- /* If no image found and a $default_image is set, get the default image. */
90
- if ( !$image && $default_image )
91
- $image = image_by_default( $args );
92
 
93
- /* If an image is returned, run it through the display function. */
94
- if ( $image )
95
- $image = display_the_image( $args, $image );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  /* Allow plugins/theme to override the final output. */
98
  $image = apply_filters( 'get_the_image', $image );
99
 
100
  /* Display the image if $echo is set to true and the $format isn't an array. Else, return the image. */
101
- if ( $echo && 'array' !== $format )
 
 
 
 
 
 
 
 
 
102
  echo $image;
103
  else
104
  return $image;
@@ -156,13 +196,16 @@ function image_by_the_post_thumbnail( $args = array() ) {
156
  return false;
157
 
158
  /* Apply filters on post_thumbnail_size because this is a default WP filter used with its image feature. */
159
- $size = apply_filters( 'post_thumbnail_size', $args['default_size'] );
160
 
161
  /* Get the attachment image source. This should return an array. */
162
  $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
163
 
 
 
 
164
  /* Return both the image URL and the post thumbnail ID. */
165
- return array( 'url' => $image[0], 'post_thumbnail_id' => $post_thumbnail_id );
166
  }
167
 
168
  /**
@@ -179,20 +222,29 @@ function image_by_attachment( $args = array() ) {
179
  /* Get attachments for the inputted $post_id. */
180
  $attachments = get_children( array( 'post_parent' => $args['post_id'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) );
181
 
182
- /* If no attachments are found, return false. */
183
- if ( empty( $attachments ) )
 
 
 
 
 
 
 
 
184
  return false;
185
 
186
  /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
187
  foreach ( $attachments as $id => $attachment ) {
188
  if ( ++$i == $args['order_of_image'] ) {
189
- $image = wp_get_attachment_image_src( $id, $args['default_size'] );
 
190
  break;
191
  }
192
  }
193
 
194
  /* Return the image URL. */
195
- return array( 'url' => $image[0] );
196
  }
197
 
198
  /**
@@ -246,11 +298,12 @@ function display_the_image( $args = array(), $image = false ) {
246
  /* Extract the arguments for easy-to-use variables. */
247
  extract( $args );
248
 
 
 
 
249
  /* If there is a width or height, set them as HMTL-ready attributes. */
250
- if ( $width )
251
- $width = ' width="' . $width . '"';
252
- if ( $height )
253
- $height = ' height="' . $height . '"';
254
 
255
  /* Loop through the custom field keys and add them as classes. */
256
  if ( is_array( $custom_key ) ) {
@@ -258,39 +311,44 @@ function display_the_image( $args = array(), $image = false ) {
258
  $classes[] = str_replace( ' ', '-', strtolower( $key ) );
259
  }
260
 
261
- /* Add the $default_size and any user-added $image_class to the class. */
262
- $classes[] = $default_size;
263
  $classes[] = $image_class;
264
 
265
- /* Join all the classes into a single string. */
266
- $class = join( ' ', $classes );
267
-
268
- /* If $format should be an array, return the attributes in array format. */
269
- if ( 'array' == $format )
270
- return array( 'url' => $image['url'], 'alt' => esc_attr( strip_tags( get_post_field( 'post_title', $post_id ) ) ), 'class' => $class, 'link' => get_permalink( $post_id ) );
271
 
272
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
273
  if ( $image['post_thumbnail_id'] )
274
- do_action( 'begin_fetch_post_thumbnail_html', $post_id, $image['post_thumbnail_id'], $default_size );
275
 
276
  /* Add the image attributes to the <img /> element. */
277
- $html = '<img src="' . $image['url'] . '" alt="' . esc_attr( strip_tags( get_post_field( 'post_title', $post_id ) ) ) . '" class="' . $class . '"' . $width . $height . ' />';
278
 
279
  /* If $link_to_post is set to true, link the image to its post. */
280
  if ( $link_to_post )
281
- $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
282
 
283
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
284
  if ( $image['post_thumbnail_id'] )
285
- do_action( 'end_fetch_post_thumbnail_html', $post_id, $image['post_thumbnail_id'], $default_size );
286
 
287
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
288
  if ( $image['post_thumbnail_id'] )
289
- $html = apply_filters( 'post_thumbnail_html', $html, $post_id, $image['post_thumbnail_id'], $default_size, $attr );
290
 
291
  return $html;
292
  }
293
 
 
 
 
 
 
 
 
 
 
294
  /**
295
  * Get the image with a link to the post. Use get_the_image() instead.
296
  *
3
  * Plugin Name: Get The Image
4
  * Plugin URI: http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin
5
  * Description: This is a highly intuitive script that can grab an image by custom field input, post attachment, or extracting it from the post's content.
6
+ * Version: 0.5
7
  * Author: Justin Tadlock
8
  * Author URI: http://justintadlock.com
9
  *
12
  * related to specific posts in some way. It creates an image-based representation of a WordPress
13
  * post (or any post type).
14
  *
15
+ * @copyright 2008 - 2010
16
+ * @version 0.5
17
  * @author Justin Tadlock
18
  * @link http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin
19
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
28
  /* Adds theme support for post images. */
29
  add_theme_support( 'post-thumbnails' );
30
 
31
+ /* Delete the cache when a post or post metadata is updated. */
32
+ add_action( 'save_post', 'get_the_image_delete_cache' );
33
+ add_action( 'deleted_post_meta', 'get_the_image_delete_cache' );
34
+ add_action( 'updated_post_meta', 'get_the_image_delete_cache' );
35
+ add_action( 'added_post_meta', 'get_the_image_delete_cache' );
36
+
37
  /**
38
  * This is a highly intuitive function that gets images. It first calls for custom field keys. If no
39
  * custom field key is set, check for the_post_thumbnail(). If no post image, check for images
55
  'post_id' => $post->ID,
56
  'attachment' => true,
57
  'the_post_thumbnail' => true, // WP 2.9+ image function
58
+ 'default_size' => false, // Deprecated 0.5 in favor of $size
59
+ 'size' => 'thumbnail',
60
  'default_image' => false,
61
  'order_of_image' => 1,
62
  'link_to_post' => true,
74
  /* Merge the input arguments and the defaults. */
75
  $args = wp_parse_args( $args, $defaults );
76
 
77
+ /* If $default_size is given, overwrite $size. */
78
+ if ( !empty( $args['default_size'] ) )
79
+ $args['size'] = $args['default_size'];
80
+
81
+ /* If $format is set to 'array', don't link to the post. */
82
+ if ( 'array' == $args['format'] )
83
+ $args['link_to_post'] = false;
84
+
85
  /* Extract the array to allow easy use of variables. */
86
  extract( $args );
87
 
88
+ /* Check for a cached image. */
89
+ $cache = wp_cache_get( 'get_the_image' );
 
90
 
91
+ if ( !is_array( $cache ) )
92
+ $cache = array();
 
93
 
94
+ /* If there is no cached image, let's see if one exists. */
95
+ if ( !isset( $cache[$post_id][$size] ) ) {
 
96
 
97
+ /* If a custom field key (array) is defined, check for images by custom field. */
98
+ if ( $custom_key )
99
+ $image = image_by_custom_field( $args );
100
 
101
+ /* If no image found and $the_post_thumbnail is set to true, check for a post image (WP feature). */
102
+ if ( !$image && $the_post_thumbnail )
103
+ $image = image_by_the_post_thumbnail( $args );
104
 
105
+ /* If no image found and $attachment is set to true, check for an image by attachment. */
106
+ if ( !$image && $attachment )
107
+ $image = image_by_attachment( $args );
108
+
109
+ /* If no image found and $image_scan is set to true, scan the post for images. */
110
+ if ( !$image && $image_scan )
111
+ $image = image_by_scan( $args );
112
+
113
+ /* If no image found and a $default_image is set, get the default image. */
114
+ if ( !$image && $default_image )
115
+ $image = image_by_default( $args );
116
+
117
+ /* If an image is returned, run it through the display function. */
118
+ if ( $image )
119
+ $image = display_the_image( $args, $image );
120
+
121
+ $cache[$post_id][$size] = $image;
122
+ wp_cache_set( 'get_the_image', $cache );
123
+ }
124
+ else {
125
+ $image = $cache[$post_id][$size];
126
+ }
127
 
128
  /* Allow plugins/theme to override the final output. */
129
  $image = apply_filters( 'get_the_image', $image );
130
 
131
  /* Display the image if $echo is set to true and the $format isn't an array. Else, return the image. */
132
+ if ( 'array' == $format ) {
133
+ $atts = wp_kses_hair( $image, array( 'http' ) );
134
+
135
+ foreach ( $atts as $att )
136
+ $out[$att['name']] = $att['value'];
137
+
138
+ $out['url'] = $out['src']; // @deprecated 0.5 Use 'src' instead of 'url'.
139
+ return $out;
140
+ }
141
+ elseif ( $echo )
142
  echo $image;
143
  else
144
  return $image;
196
  return false;
197
 
198
  /* Apply filters on post_thumbnail_size because this is a default WP filter used with its image feature. */
199
+ $size = apply_filters( 'post_thumbnail_size', $args['size'] );
200
 
201
  /* Get the attachment image source. This should return an array. */
202
  $image = wp_get_attachment_image_src( $post_thumbnail_id, $size );
203
 
204
+ /* Get the attachment excerpt to use as alt text. */
205
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $post_thumbnail_id ) ) );
206
+
207
  /* Return both the image URL and the post thumbnail ID. */
208
+ return array( 'url' => $image[0], 'post_thumbnail_id' => $post_thumbnail_id, 'alt' => $alt );
209
  }
210
 
211
  /**
222
  /* Get attachments for the inputted $post_id. */
223
  $attachments = get_children( array( 'post_parent' => $args['post_id'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) );
224
 
225
+ /* If no attachments are found, check if the post itself is an attachment and grab its image. */
226
+ if ( empty( $attachments ) && $args['size'] ) {
227
+ if ( 'attachment' == get_post_type( $args['post_id'] ) ) {
228
+ $image = wp_get_attachment_image_src( $args['post_id'], $args['size'] );
229
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $args['post_id'] ) ) );
230
+ }
231
+ }
232
+
233
+ /* If no attachments or image is found, return false. */
234
+ if ( empty( $attachments ) && empty( $image ) )
235
  return false;
236
 
237
  /* Loop through each attachment. Once the $order_of_image (default is '1') is reached, break the loop. */
238
  foreach ( $attachments as $id => $attachment ) {
239
  if ( ++$i == $args['order_of_image'] ) {
240
+ $image = wp_get_attachment_image_src( $id, $args['size'] );
241
+ $alt = trim( strip_tags( get_post_field( 'post_excerpt', $id ) ) );
242
  break;
243
  }
244
  }
245
 
246
  /* Return the image URL. */
247
+ return array( 'url' => $image[0], 'alt' => $alt );
248
  }
249
 
250
  /**
298
  /* Extract the arguments for easy-to-use variables. */
299
  extract( $args );
300
 
301
+ /* If there is alt text, set it. Otherwise, default to the post title. */
302
+ $image_alt = ( ( $image['alt'] ) ? $image['alt'] : apply_filters( 'the_title', get_post_field( 'post_title', $post_id ) ) );
303
+
304
  /* If there is a width or height, set them as HMTL-ready attributes. */
305
+ $width = ( ( $width ) ? ' width="' . esc_attr( $width ) . '"' : '' );
306
+ $height = ( ( $height ) ? ' height="' . esc_attr( $height ) . '"' : '' );
 
 
307
 
308
  /* Loop through the custom field keys and add them as classes. */
309
  if ( is_array( $custom_key ) ) {
311
  $classes[] = str_replace( ' ', '-', strtolower( $key ) );
312
  }
313
 
314
+ /* Add the $size and any user-added $image_class to the class. */
315
+ $classes[] = $size;
316
  $classes[] = $image_class;
317
 
318
+ /* Join all the classes into a single string and make sure there are no duplicates. */
319
+ $class = join( ' ', array_unique( $classes ) );
 
 
 
 
320
 
321
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
322
  if ( $image['post_thumbnail_id'] )
323
+ do_action( 'begin_fetch_post_thumbnail_html', $post_id, $image['post_thumbnail_id'], $size );
324
 
325
  /* Add the image attributes to the <img /> element. */
326
+ $html = '<img src="' . $image['url'] . '" alt="' . esc_attr( strip_tags( $image_alt ) ) . '" class="' . esc_attr( $class ) . '"' . $width . $height . ' />';
327
 
328
  /* If $link_to_post is set to true, link the image to its post. */
329
  if ( $link_to_post )
330
+ $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( apply_filters( 'the_title', get_post_field( 'post_title', $post_id ) ) ) . '">' . $html . '</a>';
331
 
332
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
333
  if ( $image['post_thumbnail_id'] )
334
+ do_action( 'end_fetch_post_thumbnail_html', $post_id, $image['post_thumbnail_id'], $size );
335
 
336
  /* If there is a $post_thumbnail_id, apply the WP filters normally associated with get_the_post_thumbnail(). */
337
  if ( $image['post_thumbnail_id'] )
338
+ $html = apply_filters( 'post_thumbnail_html', $html, $post_id, $image['post_thumbnail_id'], $size, '' );
339
 
340
  return $html;
341
  }
342
 
343
+ /**
344
+ * Deletes the image cache for users that are using a persistent-caching plugin.
345
+ *
346
+ * @since 0.5
347
+ */
348
+ function get_the_image_delete_cache() {
349
+ wp_cache_delete( 'get_the_image' );
350
+ }
351
+
352
  /**
353
  * Get the image with a link to the post. Use get_the_image() instead.
354
  *
readme.html CHANGED
@@ -44,7 +44,7 @@
44
 
45
  <p><strong>Example with function-style parameters</strong></p>
46
 
47
- <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'default_size' => 'thumbnail' ) ); ?></code></pre>
48
 
49
  <h2>The image script parameters</h2>
50
 
@@ -53,7 +53,7 @@
53
  <pre><code>$defaults = array(
54
  'custom_key' => array( 'Thumbnail', 'thumbnail' ),
55
  'attachment' => true,
56
- 'default_size' => 'thumbnail',
57
  'the_post_thumbnail' => true,
58
  'default_image' => false,
59
  'order_of_image' => 1,
@@ -70,10 +70,10 @@
70
  <dd>This parameter refers to a custom field key (or keys) that you use. Remember, custom field keys are case-sensitive (defaults are <code>Thumbnail</code> and <code>thumbnail</code>).</dd>
71
  <dt>attachment</dt>
72
  <dd>The script will look for images attached to the post (set to <code>true</code> by default).</dd>
73
- <dt>default_size</dt>
74
- <dd>This refers to the default size of an attached image. You can choose between <code>thumbnail</code>, <code>medium</code>, <code>large</code> (WP 2.7+), or <code>full</code> (the default is <code>thumbnail</code>).</dd>
75
  <dt>the_post_thumbnail</dt>
76
- <dd>This refers to the WordPress 2.9's new <code>the_post_thumbnail()</code> feature. By having this set to <code>true</code>, you may select an image from the post image meta box while in the post editor.
77
  <dt>default_image</dt>
78
  <dd>Will take the input of an image URL and use it if no other images are found (no default set).</dd>
79
  <dt>order_of_image</dt>
@@ -102,7 +102,7 @@
102
 
103
  <p><strong>Example 2:</strong> Let's suppose you want a full-sized image and maybe you want to grab it by a custom field key of <code>Feature</code>. Depending on your theme, this will need to go within the Loop in whatever file is calling the featured article.</p>
104
 
105
- <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Feature' ), 'default_size' => 'full' ) ); ?></code></pre>
106
 
107
  <p>If no feature image exists by custom field, it will look for images attached to your post.</p>
108
 
@@ -126,7 +126,7 @@
126
 
127
  &lt;div id="post-&lt;?php the_ID(); ?>" &lt;?php post_class(); ?>>
128
 
129
- &lt;?php get_the_image( array( 'custom_key' => array( 'feature_img' ), 'default_size' => 'medium', 'width' => '200', 'height' => '200', 'image_class' => 'feature' ) ); ?>
130
 
131
  &lt;h2>&lt;a href="&lt;?php the_permalink(); ?>" title="&lt;?php the_title_attribute(); ?>" rel="bookmark">&lt;?php the_title(); ?>&lt;/a>&lt;/h2>
132
 
@@ -156,7 +156,7 @@
156
 
157
  <p>Let's suppose you've used this code:</p>
158
 
159
- <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Donkey Kong', 'mario' ), 'default_size' => 'full' ) ); ?></code></pre>
160
 
161
  <p>This will give you these CSS classes to work with:</p>
162
 
@@ -168,7 +168,7 @@ img.mario { }</code></pre>
168
 
169
  <pre><code>&lt;?php get_the_image( array( 'image_class' => 'custom-image' ) ); ?></code></pre>
170
 
171
- <p>You will still have the <code>default_size</code> and <code>custom_key</code> classes plus your additional class:</p>
172
 
173
  <pre><code>img.custom-image { }
174
  img.thumbnail { }</code></pre>
@@ -185,7 +185,7 @@ img.thumbnail { }</code></pre>
185
 
186
  <p>This plugin is copyrighted to <a href="http://justintadlock.com" title="Justin Tadlock">Justin Tadlock</a>.</p>
187
 
188
- <p>2008&thinsp;&ndash;&thinsp;2009 &copy; Justin Tadlock. All rights reserved.</p>
189
 
190
  </body>
191
  </html>
44
 
45
  <p><strong>Example with function-style parameters</strong></p>
46
 
47
+ <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'size' => 'thumbnail' ) ); ?></code></pre>
48
 
49
  <h2>The image script parameters</h2>
50
 
53
  <pre><code>$defaults = array(
54
  'custom_key' => array( 'Thumbnail', 'thumbnail' ),
55
  'attachment' => true,
56
+ 'size' => 'thumbnail',
57
  'the_post_thumbnail' => true,
58
  'default_image' => false,
59
  'order_of_image' => 1,
70
  <dd>This parameter refers to a custom field key (or keys) that you use. Remember, custom field keys are case-sensitive (defaults are <code>Thumbnail</code> and <code>thumbnail</code>).</dd>
71
  <dt>attachment</dt>
72
  <dd>The script will look for images attached to the post (set to <code>true</code> by default).</dd>
73
+ <dt>size</dt>
74
+ <dd>This refers to the size of an attached image. You can choose between <code>thumbnail</code>, <code>medium</code>, <code>large</code>, <code>full</code>, or any custom image size you have available (the default is <code>thumbnail</code>).</dd>
75
  <dt>the_post_thumbnail</dt>
76
+ <dd>This refers to the WordPress 2.9's new <code>the_post_thumbnail()</code> feature. By having this set to <code>true</code>, you may select an image from the post image meta box while in the post editor.</dd>
77
  <dt>default_image</dt>
78
  <dd>Will take the input of an image URL and use it if no other images are found (no default set).</dd>
79
  <dt>order_of_image</dt>
102
 
103
  <p><strong>Example 2:</strong> Let's suppose you want a full-sized image and maybe you want to grab it by a custom field key of <code>Feature</code>. Depending on your theme, this will need to go within the Loop in whatever file is calling the featured article.</p>
104
 
105
+ <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Feature' ), 'size' => 'full' ) ); ?></code></pre>
106
 
107
  <p>If no feature image exists by custom field, it will look for images attached to your post.</p>
108
 
126
 
127
  &lt;div id="post-&lt;?php the_ID(); ?>" &lt;?php post_class(); ?>>
128
 
129
+ &lt;?php get_the_image( array( 'custom_key' => array( 'feature_img' ), 'size' => 'medium', 'width' => '200', 'height' => '200', 'image_class' => 'feature' ) ); ?>
130
 
131
  &lt;h2>&lt;a href="&lt;?php the_permalink(); ?>" title="&lt;?php the_title_attribute(); ?>" rel="bookmark">&lt;?php the_title(); ?>&lt;/a>&lt;/h2>
132
 
156
 
157
  <p>Let's suppose you've used this code:</p>
158
 
159
+ <pre><code>&lt;?php get_the_image( array( 'custom_key' => array( 'Donkey Kong', 'mario' ), 'size' => 'full' ) ); ?></code></pre>
160
 
161
  <p>This will give you these CSS classes to work with:</p>
162
 
168
 
169
  <pre><code>&lt;?php get_the_image( array( 'image_class' => 'custom-image' ) ); ?></code></pre>
170
 
171
+ <p>You will still have the <code>size</code> and <code>custom_key</code> classes plus your additional class:</p>
172
 
173
  <pre><code>img.custom-image { }
174
  img.thumbnail { }</code></pre>
185
 
186
  <p>This plugin is copyrighted to <a href="http://justintadlock.com" title="Justin Tadlock">Justin Tadlock</a>.</p>
187
 
188
+ <p>2008&thinsp;&ndash;&thinsp;2010 &copy; Justin Tadlock. All rights reserved.</p>
189
 
190
  </body>
191
  </html>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: greenshady
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3687060
4
  Tags: image, images, thumbnail
5
  Requires at least: 2.9
6
- Tested up to: 2.9
7
- Stable tag: 0.4
8
 
9
  An easy-to-use image script for adding things such as thumbnails and feature images.
10
 
@@ -58,6 +58,14 @@ You can view this plugin in action on my <a href="http://justintadlock.com" titl
58
 
59
  Earlier versions were not documented well.
60
 
 
 
 
 
 
 
 
 
61
  **Version 0.4**
62
 
63
  * Dropped support for older versions of WordPress. Now only compatible with 2.9+.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3687060
4
  Tags: image, images, thumbnail
5
  Requires at least: 2.9
6
+ Tested up to: 3.0
7
+ Stable tag: 0.5
8
 
9
  An easy-to-use image script for adding things such as thumbnails and feature images.
10
 
58
 
59
  Earlier versions were not documented well.
60
 
61
+ **Version 0.5**
62
+
63
+ * Added support for persistent-caching plugins.
64
+ * Switched the `default_size` argument to `size` to be more in line with the WordPress post thumbnail arguments, but `default_size` will still work.
65
+ * Now using `wp_kses_hair()` to extract image attributes when using the `array` value for `format`.
66
+ * Image `alt` text will now use the attachment description if one has been given rather than the post title.
67
+ * Updated the `readme.html` instructions for using the plugin.
68
+
69
  **Version 0.4**
70
 
71
  * Dropped support for older versions of WordPress. Now only compatible with 2.9+.