/** * Move file to the other path. * * @access public * @param string $sPath * @return File * @since 2.36.4-dev, 2015-07-03 * @version 2.37.0-dev, 2015-07-28 */ public function moveFile($sPath) { \FileManager::prepareDir($sPath); $oFileManager = new \FileManager(); $oFileManager->prepareFileByPath($this->getPath() . '/' . $this->getNameWithExt()); $oFileManager->move($sPath); $this->setName($oFileManager->getName()); // if file name was changed in \FileManager class $this->setPath($oFileManager->getPath()); return $this; }
/** * Save the image in given path. * * @access public * @param string $sPath path * @param integer $iQuality only if jpg/jpeg * @return \Image * @since 1.0.0 * @version 1.1.7, 2014-07-15 */ public function save($sPath, $iQuality = 100) { $sPath = str_replace('/', DIRECTORY_SEPARATOR, $sPath); $aExplodedPath = explode('.', $sPath); $iType = static::extensionToImageType(end($aExplodedPath)); if (\FileManager::prepareDir($sPath, TRUE) === FALSE) { throw new \Plethora\Exception\Fatal('Can\'t create particular path ("' . $sPath . '").'); } switch ($iType) { case self::PNG: imagepng($this->rImage, $sPath); break; case self::JPEG: imagejpeg($this->rImage, $sPath, $iQuality); break; case self::GIF: imagegif($this->rImage, $sPath); break; case self::GD: imagegd($this->rImage, $sPath); break; case self::GD2: imagegd2($this->rImage, $sPath); break; } return $this; }