From 4bef86fb87593c8b5c10a58c456ef1adbddde717 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 22 Nov 2015 13:04:21 -0800 Subject: [PATCH] Include associated menu image in page meta. --- e107_handlers/e_parse_class.php | 6 ++++++ page.php | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 2d8f43a9e..76e3b6629 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3258,6 +3258,12 @@ class e_parser */ function isImage($file) { + if(substr($file,0,3)=="{e_") + { + $file = e107::getParser()->replaceConstants($file); + } + + $ext = pathinfo($file,PATHINFO_EXTENSION); return ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') ? true : false; diff --git a/page.php b/page.php index 0722a4516..7be36f457 100644 --- a/page.php +++ b/page.php @@ -645,7 +645,16 @@ class pageClass define('e_PAGETITLE', eHelper::formatMetaTitle($this->page['page_title'])); if($this->page['page_metadscr']) define('META_DESCRIPTION', eHelper::formatMetaDescription($this->page['page_metadscr'])); if($this->page['page_metakeys']) define('META_KEYWORDS', eHelper::formatMetaKeys($this->page['page_metakeys'])); - //return $ret; + + $tp = e107::getParser(); + + if($tp->isImage($this->page['menu_image'])) + { + $mimg = $tp->thumbUrl($this->page['menu_image'],'w=800', false, true); + e107::meta('og:image',$mimg); + } + + //return $ret; } public function checkCache()