From d0c1fdf285894ceb90a9d26e82220be80d04f796 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 9 Aug 2014 19:34:48 +0400 Subject: [PATCH] FIX OG --- ground/controllers/IndexController.php | 2 +- ground/models/Point.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index ff0a081..f865183 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -66,7 +66,7 @@ class IndexController extends Controller $og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома'; $og['type'] = 'article'; $og['url'] = 'http://wikipoints.ru/?point='.$id; - $og['image'] = $point->img; + $og['image'] = $point->getImg(); } else if(isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random') { diff --git a/ground/models/Point.php b/ground/models/Point.php index 4d97953..98f2d16 100644 --- a/ground/models/Point.php +++ b/ground/models/Point.php @@ -15,5 +15,18 @@ class Point extends Model { return new self(); } + + public function getImg() + { + $img = $this->img; + if ($img == '') + { + $img = array_shift($this->photos); + $img = '/photos/middle/' . $img->name; + } + + return $img; + } + }