Forums

Get the Image
Notice thrown by image_by_scan() (3 posts)

  1. Michael Fields
    Theme Wrangler
    Posted 11 months ago #

    I'm helping someone use this plugin with my Taxonomy Images plugin. Here's the code that I am using (outside the loop in single.php)

    if ( function_exists( 'get_the_image' ) ) {
    	$src = get_the_image( array(
    		'return_url'    => 'true',
    		'echo'          => 'false',
    		'link_to_post'  => 'false',
    		'default_image' => '/a/screen/default_image.jpg',
    		'image_scan'    => 'true',
    		'meta_key'      => 'feature_img',
    		'width'         => '45',
    		'height'        => '55',
    		'echo'          => false
    	) );
    }

    This triggers php to throw the following notice:

    Notice: Undefined offset: 0 in /Sites/plugins/get-the-image/get-the-image.php on line 313

    Line 313 has the following code:

    if ( isset( $matches ) && $matches[1][0] )
        return array( 'url' => $matches[1][0] );

    The following modification removes the notice:

    if ( isset( $matches[1][0] ) )
        return array( 'url' => $matches[1][0] );

    http://wordpress.org/extend/plugins/get-the-image/

  2. Justin Tadlock
    Member
    Posted 11 months ago #

    Thanks, Michael. That one must've slipped past my radar.

  3. Michael Fields
    Theme Wrangler
    Posted 11 months ago #

    No problem!

Reply

You must log in to post.

About this Plugin

About this Topic