WordPress.org

Plugin Directory

Changeset 622258


Ignore:
Timestamp:
11/07/12 20:09:16 (18 months ago)
Author:
mdawaffe
Message:

Open Graph: Adding filters to minimum image width & height for customizing image size in Open Graph meta tag og:image

Props alisothegeek

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/functions.opengraph.php

    r622242 r622258  
    1818    $tags = array(); 
    1919 
    20     $image_width = 200; 
    21     $image_height = 200; 
     20    $image_width  = absint( apply_filters( 'jetpack_open_graph_image_width', 200 ) ); 
     21    $image_height = absint( apply_filters( 'jetpack_open_graph_image_height', 200 ) ); 
    2222    $description_length = 197; 
    2323 
     
    6060    if ( is_array( $tags['og:image'] ) ) { 
    6161        // We got back more than one image from Jetpack_PostImages, so we need to extract just the thumb 
     62        $fit_width  = $image_width * 2; 
     63        $fit_height = $image_height * 2; 
     64 
    6265        $imgs = array(); 
    6366        foreach ( $tags['og:image'] as $img ) { 
    64             $imgs[] = jetpack_photon_url( $img['src'], array( 'fit' => '400,400' ) ); 
     67            $imgs[] = jetpack_photon_url( $img['src'], array( 'fit' => "$fit_width,$fit_height" ) ); 
    6568        } 
    6669        $tags['og:image'] = $imgs; 
     
    7679    // Add any additional tags here, or modify what we've come up with 
    7780    $tags = apply_filters( 'jetpack_open_graph_tags', $tags ); 
    78      
     81 
    7982    foreach ( (array) $tags as $tag_property => $tag_content ) { 
    8083        foreach ( (array) $tag_content as $tag_content_single ) { // to accomodate multiple images 
Note: See TracChangeset for help on using the changeset viewer.