Exemplo n.º 1
0
 /**
  * SMImage | boolean getSubstitute()
  * Arguments: none
  * Returns:	an instance of SMImage containing the substitute for this image type
  *			false if such a substitute cannot be found
  */
 public function getSubstitute()
 {
     if (SMImage::inBakeout($this->date)) {
         $swap_sub = "trce_m0171";
     } else {
         $swap_sub = "seit_00171";
     }
     $map = array("bake_00195" => false, "smdi_maglc" => "gong_maglc", "smdi_igram" => "gong_igram", "swap_00171" => $swap_sub);
     if (array_key_exists($this->type, $map)) {
         if ($map[$this->type] == false) {
             return false;
         }
         $sub = new SMImage($map[$this->type], $this->date, $this->regionNumber);
         if ($sub->requiresSubstitute()) {
             return false;
         }
         return $sub;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
<?php

include "globals.php";
include "include.php";
include "image.class.php";
$json = array("imageSources" => array());
$types = SMImage::getAvailableImageTypes($date);
for ($i = 0; $i < count($types); $i++) {
    $obj = new SMImage($types[$i], $date);
    if ($obj->requiresSubstitute()) {
        $obj = $obj->getSubstitute();
        if ($obj == false) {
            continue;
        }
    }
    $file = $obj->getLatestFilename();
    $json["imageSources"][] = array("time" => $obj->getTimestampForFilename($file), "type" => $obj->type, "name" => $obj->getName(), "image" => $obj->getThumbnail(), "fullRes" => $file);
}
print json_encode($json);