public function testLowPriority()
 {
     /** @var $imageFile ImageFile */
     $imageFile = $this->unistorage->uploadFile(FIXTURES_DIR . '/ImageFile.jpg');
     $this->assertInstanceOf('Unistorage\\Models\\Files\\ImageFile', $imageFile);
     $resultFile = $imageFile->convert('png', true, $this->unistorage);
     $this->assertTrue($resultFile instanceof ImageFile || $resultFile instanceof TemporaryFile || $resultFile instanceof PendingFile, 'Failed asserting type of resultFile after convert');
 }
 /**
  * @param RegularFile[] $files
  * @param string $zipFileName
  * @return \Unistorage\Models\Files\ZipFile|bool
  */
 public function safeGetZipped($files, $zipFileName)
 {
     try {
         $file = parent::getZipped($files, $zipFileName);
     } catch (Exception $e) {
         Yii::error('Can\'t getZipped ' . print_r(array($files, $zipFileName), true) . $e, 'unistorage');
         return false;
     }
     return $file;
 }
 /**
  * $wmWidth, $wmHeight, $horizontalPadding, $verticalPadding may have following format:
  * <ul>
  * <li> (\d+)px - number calculates in pixels
  * <li> (\d+) - number calculates in percents
  * </ul>
  *
  * @param ImageFile $watermark
  * @param string $wmWidth watermark width
  * @param string $wmHeight watermark height
  * @param string $horizontalPadding padding of watermark
  * @param string $verticalPadding padding of watermark
  * @param string $corner one of ImageFile::CORNER_*
  * @param bool $lowPriority
  * @param Unistorage $unistorage
  *
  * @return File
  */
 public function watermark($watermark, $wmWidth, $wmHeight, $horizontalPadding, $verticalPadding, $corner, $lowPriority = false, $unistorage)
 {
     return $unistorage->applyAction($this, RegularFile::ACTION_WATERMARK, array('watermark' => $watermark->resourceUri, 'w' => $wmWidth, 'h' => $wmHeight, 'w_pad' => $horizontalPadding, 'h_pad' => $verticalPadding, 'corner' => $corner), $lowPriority);
 }
 /**
  * @param string $format
  * @param bool $lowPriority
  * @param Unistorage $unistorage
  *
  * @return File
  */
 public function convert($format, $lowPriority = false, $unistorage)
 {
     return $unistorage->applyAction($this, RegularFile::ACTION_CONVERT, array('to' => $format), $lowPriority);
 }
 /**
  * @param string $format
  * @param integer $position
  * @param bool $lowPriority
  * @param Unistorage $unistorage
  *
  * @return File
  */
 public function captureFrame($format, $position, $lowPriority = false, $unistorage)
 {
     return $unistorage->applyAction($this, 'capture_frame', array('to' => $format, 'position' => $position), $lowPriority);
 }
 /**
  * @param Template $template
  * @param bool $lowPriority
  * @param Unistorage $unistorage
  *
  * @return File
  */
 public function apply($template, $lowPriority = false, $unistorage)
 {
     return $unistorage->applyTemplate($this, $template, $lowPriority);
 }