/** * Return list of JP2 files to use for JPX generation selected by Mid Points * * @return array List of filepaths of images to use during JPX generation * as well as a list of the times for each image in the * series. */ private function _queryJPXImageFramesMidPoint() { include_once HV_ROOT_DIR . '/../src/Helper/DateTimeConversions.php'; include_once HV_ROOT_DIR . '/../src/Database/ImgIndex.php'; $imgIndex = new Database_ImgIndex(); // Parse List of dates and convert them to Unix Timestaps $startTimesArray = explode(',', $this->_startTime); $endTimesArray = explode(',', $this->_endTime); if (count($startTimesArray) < 1 || count($endTimesArray) < 1) { throw new Exception('At least one Start and End date need to be specified. Please use timestamps separated with commas.', 61); } if (count($startTimesArray) != count($endTimesArray)) { throw new Exception('Number of Start dates doesn\'t match the number of End dates. Please use equal amount of Start and End dates.', 61); } $images = array(); $dates = array(); foreach ($startTimesArray as $k => $start) { $end = $endTimesArray[$k]; $middle = round(($start + $end) / 2); $results = $imgIndex->getDataMidPoint($start, $end, $middle, $this->_sourceId); if ($results && isset($results['id'])) { $filepath = HV_JP2_DIR . $results['filepath'] . '/' . $results['filename']; array_push($images, $filepath); array_push($dates, strtotime($results['date'])); } else { array_push($images, null); array_push($dates, null); } } return array($images, $dates); }