/** * Create new WPSEO_OpenGraph_Image class and get the images to set the og:image * * @param mixed $image */ public function image($image = false) { $opengraph_images = new WPSEO_OpenGraph_Image($this->options, $image); foreach ($opengraph_images->get_images() as $img) { $this->og_tag('og:image', esc_url($img)); } }
/** * Create new WPSEO_OpenGraph_Image class and get the images to set the og:image * * @param string|boolean $image Optional image URL. */ public function image($image = false) { $opengraph_images = new WPSEO_OpenGraph_Image($this->options, $image); foreach ($opengraph_images->get_images() as $img) { $this->og_tag('og:image', esc_url($img)); } $dimensions = $opengraph_images->get_dimensions(); if (!empty($dimensions['width'])) { $this->og_tag('og:image:width', absint($dimensions['width'])); } if (!empty($dimensions['height'])) { $this->og_tag('og:image:height', absint($dimensions['height'])); } }