/** * @param RegularFile $file * @param string $actionName * @param array $actionParams * @param bool $lowPriority * @return File|bool */ public function safeApplyAction($file, $actionName, $actionParams = array(), $lowPriority = false) { try { $file = parent::applyAction($file, $actionName, $actionParams, $lowPriority); } catch (Exception $e) { Yii::error('Can\'t applyAction ' . print_r(array($file, $actionName, $actionParams), 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); }