";
print_r($val);
echo '';
}
// Updated 5/25/2018
// this function captures the images from the designated folder
// into an array; compares them to the popup array to match the images by date; and renders an image stack of specified length
$animationImages = array();
$popupImages = array();
$animationBlock = "";
$animationImages = $catalog['images'][$animationDimension];
$popupImages = $catalog['images'][$popupDimension];
$animationImgTimeStamps = array(); // array for animation img time stamps
$popupImgTimeStamps = array(); // array for popup img time stamps
$animationPaired = array(); // key > value pairing of timestamps & animation imgs
$popupPaired = array(); // key > value pairing of timestamps & popup imgs
$confirmedAnimImages = array();
$confirmedPopupImages = array();
if (isset($animationImages[0])) { // Are there any animation images?
// make array of image timestamps for anim
foreach($animationImages as $item) {
$q = substr($item,0,11);
array_push($animationImgTimeStamps,$q);
}
// make array of image timestamps for popups
foreach($popupImages as $thing) {
$x = substr($thing,0,11);
array_push($popupImgTimeStamps,$x);
}
// zip each array together, timestamp (key) with its filename (value) counterpart
$animationPaired = array_combine($animationImgTimeStamps, $animationImages);
$popupPaired = array_combine($popupImgTimeStamps, $popupImages);
foreach ($animationPaired as $animTS => $animImg) {
if (array_search($animTS,$popupImgTimeStamps)) {
// add that candidate popup image to the array
array_push($confirmedPopupImages, $popupPaired[$animTS]);
}
else {
array_push($confirmedPopupImages, ""); // stick in a blank placeholder
}
}
// now that we have matching lists, trim to requested length
$truncatedList = array_slice($animationImages,-$animationMaxSize);
$truncatedPopup = array_slice($confirmedPopupImages,-$animationMaxSize);
$animationBlock .= "
\n";
$counter = 1;
foreach (array_combine($truncatedList, $truncatedPopup) as $animImg => $popup) {
//**** http://stackoverflow.com/questions/12199556/how-to-convert-a-julian-day-not-date-and-gregorian-year-to-a-gregorian-date-wi
$JulianDay = substr($animImg,4,3);
$JulianDay = $JulianDay - 1; // have to substract 1 day to make it correct.
$Year = substr($animImg,0,4);
$DateYear = date("Y/m/d", mktime(0, 0, 0, 1, 1, $Year));
$GregDate = new DateTime($DateYear);
$GregDate->modify("+$JulianDay day");
$usableDate = $GregDate->format('d M Y');
// filename sample 20170872130_GOES16-ABI-01-CONUS-1024x512.png
$timeString = substr($animImg,7,4) . " UTC";
$DTC = $usableDate . " - " . $timeString;
if ($popup == "") { // that is, the popup image isn't available
$popupURL = $imagePath . $animImg;
} else {
$popupURL = $imagePath . $popup; // there is a filename for $popup, use it
}
// if the $popupDimension isn't bigger than the image used in the animation
// then zoom feature isn't needed; (distracting in display)
// compare dimensions of $popupDimension to animation images; if same, use static FB class, not FBAnim
$popupWidth = substr($popupDimension,0,strpos($popupDimension,'x'));
$animWidth = substr($animationDimension,0,strpos($animationDimension,'x'));
$animHeight = substr($animationDimension,strpos($animationDimension,'x')+1);
if ($popupWidth <= $animWidth) {
$FBClass = 'FBAnimNZ';
} else {
$FBClass = 'FBAnim';
}
if ($animImg == $truncatedList[0]) {
$animationBlock .= "
\n";
}
if ($animImg !== $truncatedList[0]) {
$animationBlock .= "
\n";
$animationBlock .= "
" . $productLabel . " - " . $DTC . "
\n"; // from icvs-new
$animationBlock .= "

\n";
// gives SECTORS and floaters the option of weather and lat/lon overlays
// if ((strpos($imagePath, "SECTOR") !== FALSE) || (strpos($imagePath, "FLOATER") !== FALSE)) { // use this version when weather layers are available
if (strpos($imagePath, "SECTOR") !== FALSE) {
$animationBlock .= "
";
if (strpos($imagePath, "FLOATER") == FALSE) { // floaters have lat/lon grid built into the image
$animationBlock .= "
\n";
}
// $animationBlock .= "

\n";
// $animationBlock .= "

\n";
// $animationBlock .= "

\n";
// $animationBlock .= "

\n";
// $animationBlock .= "

";
// $animationBlock .= "\n";
}
$animationBlock .= "
\n";
}
$counter++; // increment the counter so that each image will have a unique id
}
$animationBlock .= "
\n";
}
else {
// this is for the case of no instances of the product being available
$animationBlock .= "