Support » Plugin: OG » image problems

  • Resolved veganadvocate

    (@veganadvocate)


    seems that this plugin use favicon.ico instead of the image in the article, that needs to be fixed

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Marcin Pietrzak

    (@iworks)

    Dear @veganadvocate

    I can not reproduce it. Here is an example:

    http://iworks.pl/2017/05/05/byc-wtyczka-czy-nie-byc-wtyczka/

    And you can check HTML source:

    
    <link rel="image_src" href="http://iworks.pl/wp-content/uploads/2017/05/18194740-10213017963867117-8253121287810447904-n.jpg" />
    <meta itemprop="image" content="http://iworks.pl/wp-content/uploads/2017/05/18194740-10213017963867117-8253121287810447904-n.jpg" />
    <meta name="msapplication-TileImage" content="http://iworks.pl/wp-content/uploads/2017/05/18194740-10213017963867117-8253121287810447904-n.jpg" />
    
    <meta property="og:image" content="http://iworks.pl/wp-content/uploads/2017/05/18194740-10213017963867117-8253121287810447904-n.jpg" />
    <meta property="og:description" content="Zapraszam na WordCamp Lublin 2017 – 2-4 czerwca 2017" />
    <meta property="og:type" content="article" />
    <meta property="og:locale" content="pl_PL" />
    <meta property="og:site_name" content="przełam sieć" />
    <meta property="og:title" content="Być Wtyczką? Czy&nbsp;nie być Wtyczką?" />
    <meta property="og:url" content="http://iworks.pl/2017/05/05/byc-wtyczka-czy-nie-byc-wtyczka/?lang=pl" />
    <meta property="article:published_time" content="2017-05-05T11:38:49+00:00" />
    <meta property="article:modified_time" content="2017-05-05T11:38:49+00:00" />
    <meta property="article:author" content="http://iworks.pl/author/illi/" />
    <meta property="article:section" content="WordCamp" />
    <meta property="profile:first_name" content="Marcin" />
    <meta property="profile:last_name" content="Pietrzak" />
    <meta property="profile:username" content="Marcin Pietrzak" />
    <meta property="twitter:card" content="summary" />
    <meta property="twitter:title" content="Być Wtyczką? Czy&nbsp;nie być Wtyczką?" />
    <meta property="twitter:description" content="Zapraszam na WordCamp Lublin 2017 – 2-4 czerwca 2017" />
    <meta property="twitter:image" content="http://iworks.pl/wp-content/uploads/2017/05/18194740-10213017963867117-8253121287810447904-n.jpg" />
    <meta property="twitter:url" content="http://iworks.pl/2017/05/05/byc-wtyczka-czy-nie-byc-wtyczka/?lang=pl" />
    <!-- /OG -->
    

    There is no favicon.

    Could you check other plugins and it is possible to turn it off and re-tests?

    Marcin

    veganadvocate

    (@veganadvocate)

    <meta property=”og:image” content=”https://hardcoregames.azurewebsites.net/wp-content/uploads/2016/10/cropped-favicon512.png” />
    <meta property=”og:description” content=”Legendary is the Only Way to Play™” />
    <meta property=”og:type” content=”website” />
    <meta property=”og:locale” content=”en_US” />
    <meta property=”og:site_name” content=”HARDCORE GAMES™” />
    <meta property=”og:title” content=”HARDCORE GAMES™” />
    <meta property=”og:url” content=”https://hardcoregames.azurewebsites.net” />

    if i also make the feature image active then it works fine, but then i would have to edit thousands of posts

    by default WP uses the first image properly with the list of articles so perhaps your selecting the wrong image from the post hierarchy

    veganadvocate

    (@veganadvocate)

    this has the feature image set so it shows up properly

    https://hardcoregames.azurewebsites.net/franchise-hockey-manager-4/

    Plugin Author Marcin Pietrzak

    (@iworks)

    Hi @veganadvocate

    It looks like you have “favicon” set for the main page. Is it set as image of site? How looks a configured of your site?

    What do you expect as image on main page?

    Marcin

    veganadvocate

    (@veganadvocate)

    Image is on the first item on the post, floated to the top right

    https://hardcoregames.azurewebsites.net/alien-swarm-reactive-drop/

    veganadvocate

    (@veganadvocate)

    I have also used a tool to add featured image to posts that do not have one, that has helped to some extent

    Plugin Author Marcin Pietrzak

    (@iworks)

    > Image is on the first item on the post, floated to the top right

    It is correct, OG grabs the first image if feature image is not set.
    This is an expected behavior.

    Marcin

    veganadvocate

    (@veganadvocate)

    “Set All First Images As Featured” is a plugin that fills in the field for the feature image which does help, so maybe you can look at that and add some of the functionality to identify the first image properly.

    In the FAQ is written that plugin should behave like this: “What plugin add for single content?
    og:image: … or if it doesn’t exist from the first image in the post content, …”, but actually it doesn’t. No first image from content added in og:image if post_has_thumbnail() returns false.

    I’ve added some code around line 109 to solve that. It’s not a good idea to parse html with regexp, but it works:)

    			if ( function_exists( 'has_post_thumbnail' ) ) {
    				if ( has_post_thumbnail( $post->ID ) ) {
    					$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    					$src = esc_url( $thumbnail_src[0] );
    					printf( '<link rel="image_src" href="%s" />%s', $src, PHP_EOL );
    					printf( '<meta itemprop="image" content="%s" />%s', $src, PHP_EOL );
    					printf( '<meta name="msapplication-TileImage" content="%s" />%s', $src, PHP_EOL );
    					echo PHP_EOL;
    					array_unshift( $og['og']['image'], $src );
    				}
    				else {
    					// AE: post has no featured image , so we need to get first image 
    					$first_img = '';
    					$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    					$first_img = $matches [1] [0];
    
    					if(!empty($first_img)){ 
    						$og['og']['image'] = $first_img;
    					}
    				}
    			}
    

    http://enkin.ru/screens/screen_2004CB09.png
    Maybe this will help.

    Plugin Author Marcin Pietrzak

    (@iworks)

    Hi @andreyenkin,

    I added an image grab to 2.4.8 Thank you!

    Marcin

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘image problems’ is closed to new replies.