WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Michael Fields
    Themer
    Posted 3 years 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
    Plugin Author

    Posted 3 years ago #

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

  3. Michael Fields
    Themer
    Posted 3 years ago #

    No problem!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic