public function getImagesWithTag($tagValue) { $images = array(); $locationModel = new LocationModel($this->db); $tagModel = new TagModel($this->db); $tag = $tagModel->getTagByValue($tagValue); if ($tag == null) { return $images; } $query = $this->db->prepare("SELECT * FROM images WHERE tag_id = :tag_id"); $query->bindParam(':tag_id', $tag->getId()); $query->setFetchMode(PDO::FETCH_ASSOC); $query->execute(); while ($row = $query->fetch()) { if ($this->olderThan($row, 15)) { $image = $this->retrieveImage($row, $tagModel, $locationModel); $images[] = $image; } } return $images; }