Exemplo n.º 1
0
 /**
  * Gets image info about the file just uploaded.
  *
  * Also has the effect of setting metadata to be an 'indexed tag name' in returned API result if
  * 'metadata' was requested. Oddly, we have to pass the "result" object down just so it can do that
  * with the appropriate format, presumably.
  *
  * @param $result ApiResult:
  * @return Array: image info
  */
 public function getImageInfo($result)
 {
     $file = $this->getLocalFile();
     // TODO This cries out for refactoring. We really want to say $file->getAllInfo(); here.
     // Perhaps "info" methods should be moved into files, and the API should just wrap them in queries.
     if ($file instanceof UploadStashFile) {
         $imParam = ApiQueryStashImageInfo::getPropertyNames();
         $info = ApiQueryStashImageInfo::getInfo($file, array_flip($imParam), $result);
     } else {
         $imParam = ApiQueryImageInfo::getPropertyNames();
         $info = ApiQueryImageInfo::getInfo($file, array_flip($imParam), $result);
     }
     return $info;
 }
Exemplo n.º 2
0
 /**
  * Gets image info about the file just uploaded.
  *
  * Also has the effect of setting metadata to be an 'indexed tag name' in
  * returned API result if 'metadata' was requested. Oddly, we have to pass
  * the "result" object down just so it can do that with the appropriate
  * format, presumably.
  *
  * @param ApiResult $result
  * @return array Image info
  */
 public function getImageInfo($result)
 {
     $localFile = $this->getLocalFile();
     $stashFile = $this->getStashFile();
     // Calling a different API module depending on whether the file was stashed is less than optimal.
     // In fact, calling API modules here at all is less than optimal. Maybe it should be refactored.
     if ($stashFile) {
         $imParam = ApiQueryStashImageInfo::getPropertyNames();
         $info = ApiQueryStashImageInfo::getInfo($stashFile, array_flip($imParam), $result);
     } else {
         $imParam = ApiQueryImageInfo::getPropertyNames();
         $info = ApiQueryImageInfo::getInfo($localFile, array_flip($imParam), $result);
     }
     return $info;
 }