From 6b49c22dde73d3770f0f49f075ec86ff28919674 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 16 Sep 2018 16:00:19 -0400 Subject: Add function obj::hasHeadImg() We can check for the existence of an object's background image by calling getBgImg(), since it returns NULL when there is no such image. But getHeadImg() behaves differently, returning a path to 'static/img/null.jpg' (via df.php) when there is no image, making it more difficult to tell. This function addresses this concern. --- app/class/obj.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/class') diff --git a/app/class/obj.class.php b/app/class/obj.class.php index 4e44649..003738b 100644 --- a/app/class/obj.class.php +++ b/app/class/obj.class.php @@ -211,6 +211,16 @@ class obj extends table return $mesgs; } + /* + * Check whether object has a custom head set. This is necessary, since + * getHeadImg() will return a path to a default if the object doesn't + * have its own. + */ + public function hasHeadImg() : bool + { + return is_file("dynmic/heads/" . $this->guid); + } + /* * Get the URL to the head image resource for this object */ -- cgit v1.2.3