Advertisements

wp_get_attachment_thumb_file

Definition:
function wp_get_attachment_thumb_file( $post_id = 0 ) {}

Retrieve thumbnail for an attachment.

Parameters

  • int $post_id: Attachment ID.

Return values

returns:False on failure. Thumbnail file path on success.

Defined filters

  • wp_get_attachment_thumb_file
    apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID )

Source code

function wp_get_attachment_thumb_file( $post_id = 0 ) {

	$post_id = (int) $post_id;

	if ( !$post =& get_post( $post_id ) )

		return false;

	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )

		return false;



	$file = get_attached_file( $post->ID );



	if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )

		return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );

	return false;

}

3689

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: