Support » Plugin: Get the Image » [Plugin: Get the Image] Notice thrown by image_by_scan()

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Get the Image] Notice thrown by image_by_scan()’ is closed to new replies.