@param string $sSourcePath
@param string $sDestPath
@param bool   $blCreateThumbs

@return array
499897
public function uploadeMedia($sSourcePath, $sDestPath, $blCreateThumbs = false)
    {
        $this->createDirs();

        $sThumbName = '';
        $sFileName = basename($sDestPath);
        $iFileCount = 0;

        while (file_exists($sDestPath)) {
            $aFileParts = explode('.', $sFileName);
            $aFileParts = array_reverse($aFileParts);

            $sFileExt = $aFileParts[0];
            unset($aFileParts[0]);

            $sBaseName = implode('.', array_reverse($aFileParts));

            $aBaseParts = explode('_', $sBaseName);
            $aBaseParts = array_reverse($aBaseParts);

            if (strlen($aBaseParts[0]) == 1 && is_numeric($aBaseParts[0])) {
                $iFileCount = (int) $aBaseParts[0];
                unset($aBaseParts[0]);
            }

            $sBaseName = implode('_', array_reverse($aBaseParts));

            $sFileName = $sBaseName . '_' . (++$iFileCount) . '.' . $sFileExt;
            $sDestPath = dirname( $sDestPath ) . '/' . $sFileName;
        }

        move_uploaded_file($sSourcePath, $sDestPath);

        if ($blCreateThumbs) {
            try {
                $sThumbName = $this->createThumbnail($sFileName);

                $this->createMoreThumbnails($sFileName);
            } catch ( \Exception $e) {
                $sThumbName = '';
            }
        }

        return array(
            'filepath'  => $sDestPath,
            'filename'  => $sFileName,
            'thumbnail' => $sThumbName
        );
    }
1011975
public function getThumbnailUrl($bSsl = null)
    {
        $sImgName = false;
        $sDirname = "product/1/";
        if (!$this->_isFieldEmpty("oxarticles__oxthumb")) {
            $sImgName = basename($this->oxarticles__oxthumb->value);
            $sDirname = "product/thumb/";
        } elseif (!$this->_isFieldEmpty("oxarticles__oxpic1")) {
            $sImgName = basename($this->oxarticles__oxpic1->value);
        }

        $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sThumbnailsize');

        return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getProductPicUrl($sDirname, $sImgName, $sSize, 0, $bSsl);
    }
1207284
private function getNewFileLocationPayload($newPath)
    {
        $pathinfo = pathinfo($newPath);
        $newParentDir = ($pathinfo['dirname'] != '.') ? $pathinfo['dirname'] : '';
        $newFilename = $pathinfo['basename'];

        $payload = [
            'name' => $newFilename,
            'parentReference' => ['path' => $this->getParentReferenceFolder($newParentDir)],
        ];

        return $payload;
    }
23445
public function copyFromDFS( $srcFilePath, $dstFilePath = false )
    {
        $this->accumulatorStart();

        if ( $dstFilePath === false )
        {
            $dstFilePath = $srcFilePath;
        }
        $srcFilePath = $this->makeDFSPath( $srcFilePath );

        if ( file_exists( dirname( $dstFilePath ) ) )
        {
            $ret = copy( $srcFilePath, $dstFilePath );
            if ( $ret )
                $this->fixPermissions( $dstFilePath );
        }
        else
        {
            $ret = $this->createFile( $dstFilePath, fopen( $srcFilePath, 'rb' ) );
        }

        if ( $ret )
        {
            $ret = $this->copyTimestamp( $srcFilePath, $dstFilePath );
        }

        if ( !$ret && file_exists( $dstFilePath ) )
        {
            unlink( $dstFilePath );
        }

        $this->accumulatorStop();

        return $ret;
    }
290912
def _create_breadcrumbs(self, relpath):
    
    if relpath == '.':
      breadcrumbs = []
    else:
      path_parts = [os.path.basename(self._root)] + relpath.split(os.path.sep)
      path_links = ['/'.join(path_parts[1:i + 1]) for i, name in enumerate(path_parts)]
      breadcrumbs = [{'link_path': link_path, 'name': name}
                     for link_path, name in zip(path_links, path_parts)]
    return breadcrumbs
687896
public static function createThumb($sourceFile, $targetFile, $maxWidth, $maxHeight, $quality, $preserverAspectRatio, $bmpSupported = false)
    {
        $sourceImageAttr = @getimagesize($sourceFile);
        if ($sourceImageAttr === false) {
            return false;
        }
        $sourceImageWidth = isset($sourceImageAttr[0]) ? $sourceImageAttr[0] : 0;
        $sourceImageHeight = isset($sourceImageAttr[1]) ? $sourceImageAttr[1] : 0;
        $sourceImageMime = isset($sourceImageAttr["mime"]) ? $sourceImageAttr["mime"] : "";
        $sourceImageBits = isset($sourceImageAttr["bits"]) ? $sourceImageAttr["bits"] : 8;
        $sourceImageChannels = isset($sourceImageAttr["channels"]) ? $sourceImageAttr["channels"] : 3;

        if (!$sourceImageWidth || !$sourceImageHeight || !$sourceImageMime) {
            return false;
        }

        $iFinalWidth = $maxWidth == 0 ? $sourceImageWidth : $maxWidth;
        $iFinalHeight = $maxHeight == 0 ? $sourceImageHeight : $maxHeight;

        if ($sourceImageWidth <= $iFinalWidth && $sourceImageHeight <= $iFinalHeight) {
            if ($sourceFile != $targetFile) {
                copy($sourceFile, $targetFile);
            }
            return true;
        }

        if ($preserverAspectRatio)
        {
            // Gets the best size for aspect ratio resampling
            $oSize = CKFinder_Connector_CommandHandler_Thumbnail::GetAspectRatioSize($iFinalWidth, $iFinalHeight, $sourceImageWidth, $sourceImageHeight );
        }
        else {
            $oSize = array('Width' => $iFinalWidth, 'Height' => $iFinalHeight);
        }

        CKFinder_Connector_Utils_Misc::setMemoryForImage($sourceImageWidth, $sourceImageHeight, $sourceImageBits, $sourceImageChannels);

        switch ($sourceImageAttr['mime'])
        {
            case 'image/gif':
                {
                    if (@imagetypes() & IMG_GIF) {
                        $oImage = @imagecreatefromgif($sourceFile);
                    } else {
                        $ermsg = 'GIF images are not supported';
                    }
                }
                break;
            case 'image/jpeg':
                {
                    if (@imagetypes() & IMG_JPG) {
                        $oImage = @imagecreatefromjpeg($sourceFile) ;
                    } else {
                        $ermsg = 'JPEG images are not supported';
                    }
                }
                break;
            case 'image/png':
                {
                    if (@imagetypes() & IMG_PNG) {
                        $oImage = @imagecreatefrompng($sourceFile) ;
                    } else {
                        $ermsg = 'PNG images are not supported';
                    }
                }
                break;
            case 'image/wbmp':
                {
                    if (@imagetypes() & IMG_WBMP) {
                        $oImage = @imagecreatefromwbmp($sourceFile);
                    } else {
                        $ermsg = 'WBMP images are not supported';
                    }
                }
                break;
            case 'image/bmp':
                {
                    /*
                    * This is sad that PHP doesn't support bitmaps.
                    * Anyway, we will use our custom function at least to display thumbnails.
                    * We'll not resize images this way (if $sourceFile === $targetFile),
                    * because user defined imagecreatefrombmp and imagecreatebmp are horribly slow
                    */
                    if ($bmpSupported && (@imagetypes() & IMG_JPG) && $sourceFile != $targetFile) {
                        $oImage = CKFinder_Connector_Utils_Misc::imageCreateFromBmp($sourceFile);
                    } else {
                        $ermsg = 'BMP/JPG images are not supported';
                    }
                }
                break;
            default:
                $ermsg = $sourceImageAttr['mime'].' images are not supported';
                break;
        }

        if (isset($ermsg) || false === $oImage) {
            return false;
        }


        $oThumbImage = imagecreatetruecolor($oSize["Width"], $oSize["Height"]);

        if ($sourceImageAttr['mime'] == 'image/png')
        {
            $bg = imagecolorallocatealpha($oThumbImage, 255, 255, 255, 127); // (PHP 4 >= 4.3.2, PHP 5)
            imagefill($oThumbImage, 0, 0 , $bg);
            imagealphablending($oThumbImage, false);
            imagesavealpha($oThumbImage, true);
        }

        //imagecopyresampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight);
        CKFinder_Connector_Utils_Misc::fastImageCopyResampled($oThumbImage, $oImage, 0, 0, 0, 0, $oSize["Width"], $oSize["Height"], $sourceImageWidth, $sourceImageHeight, (int)max(floor($quality/20), 6));

        switch ($sourceImageAttr['mime'])
        {
            case 'image/gif':
                imagegif($oThumbImage, $targetFile);
                break;
            case 'image/jpeg':
            case 'image/bmp':
                imagejpeg($oThumbImage, $targetFile, $quality);
                break;
            case 'image/png':
                imagepng($oThumbImage, $targetFile);
                break;
            case 'image/wbmp':
                imagewbmp($oThumbImage, $targetFile);
                break;
        }

        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        if (file_exists($targetFile) && ($perms = $_config->getChmodFiles())) {
            $oldUmask = umask(0);
            chmod($targetFile, $perms);
            umask($oldUmask);
        }

        imageDestroy($oImage);
        imageDestroy($oThumbImage);

        return true;
    }
76274
def sbosrcarsh(self, prgnam, sbo_link, src_link):
        """"""
        sources = []
        name = "-".join(prgnam.split("-")[:-1])
        category = "{0}/{1}/".format(sbo_link.split("/")[-2], name)
        for link in src_link:
            source = link.split("/")[-1]
            sources.append("{0}{1}{2}".format(self.meta.sbosrcarch_link,
                                              category, source))
        return sources
1267622
def getSourcePaths(self, makeGlyphs=True, makeKerning=True, makeInfo=True):
        
        paths = []
        for name in self.sources.keys():
            paths.append(self.sources[name][0].path)
        return paths
213647
private function superior_sctrl($tab, $path=''){
    if ( ($pos = strpos($tab, '_ctrl')) ){
      // Fix the right path
      $bits = explode('/', $path);
      $count = \strlen(substr($tab, 0, $pos));
      if ( !empty($bits) ){
        while ( $count >= 0 ){
          array_pop($bits);
          $count--;
        }
        $path = implode('/', $bits).(!empty($bits) ? '/' : '');
      }
      // Fix the tab's name
      $tab = '_ctrl';
    }
    return [
      'tab' => $tab,
      'path' => $path
    ];
  }
32449
protected function checkFiles($translatedFilePath = null, $sourceFilePath = null)
	{
		$errors = array();
		if($translatedFilePath!==null && !file_exists($translatedFilePath)) {
			$errors[] = 'Translation does not exist.';
		}

		if($sourceFilePath!==null && !file_exists($sourceFilePath)) {
			$errors[] = 'Source does not exist.';
		}

		return $errors;
	}
579810
public function move(string $fromPath, string $toPath): array
    {
        $parameters = [
            'from_path' => $this->normalizePath($fromPath),
            'to_path' => $this->normalizePath($toPath),
        ];

        return $this->rpcEndpointRequest('files/move_v2', $parameters);
    }
896613
protected function createSingleFolderIfNotExists($fullPath) {
        $tempDir = codemonkey_pathTempDir;
        if (file_exists($tempDir.$fullPath) && is_dir($tempDir.$fullPath)) {
            return;
        }
        mkdir($tempDir.$fullPath);
        chmod($tempDir.$fullPath, 0775);
    }
607287
function getMockServerPathList(rootPath) {
    let list = [];

    fsHandler.search.getAll(rootPath, { globs: ['**/mockstar.config.js'] }).forEach((item) => {
        let opts = require(path.join(item.basePath, item.relativePath));

        list.push(opts.mockServerPath || path.join(opts.rootPath, 'src'));
    });

    return list;
}
688247
public function read($path) {
			try {
				return ['contents' => $this->bucket->getFileByName($path)->download()];
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error retrieving file', B2FlysystemException::B2_SDK_ERROR, $e);
			}
		}
315883
public function copyFromDFS( $srcFilePath, $dstFilePath = false )
    {
        return $this->getHandler( $srcFilePath )->copyFromDFS( $srcFilePath, $dstFilePath );
    }
1162567
public function createFolderIfNotExists($folderPath) {
        if (file_exists($folderPath) && is_dir($folderPath)) {
            return;
        }
        
        $arrFolder = explode(DIRECTORY_SEPARATOR, $folderPath);
        
        $fullPath = "";
        $first = true;
        foreach ($arrFolder as $folder) {
            if (!$folder) {
                continue; //Happens if the first char is a slash
            }
            if (!$first) {
                $fullPath .= DIRECTORY_SEPARATOR;
            } else {
                $first = false;
            }
            
            $fullPath .= $folder;
            
            try {
                $this->createSingleFolderIfNotExists($fullPath);
            } catch (Exception $e) {
                $msg = $e->getMessage();
                echo "Could not generate folder '".$fullPath."' <br />\n"
                        . $msg
                        . "<br />";
            }
        }        
    }
817624
protected function process_breadcrumbs($path) {
        // Process breadcrumb trail.
        // Note: Dropbox is case insensitive.
        // Without performing an additional API call, it isn't possible to get the path_display.
        // As a result, the path here is the path_lower.
        $breadcrumbs = [
            [
                'path' => '/',
                'name' => get_string('dropbox', 'repository_dropbox'),
            ],
        ];

        $path = rtrim($path, '/');
        $directories = explode('/', $path);
        $pathtodate = '';
        foreach ($directories as $directory) {
            if ($directory === '') {
                continue;
            }
            $pathtodate .= '/' . $directory;
            $breadcrumbs[] = [
                    'path'  => $pathtodate,
                    'name'  => $directory,
                ];
        }

        return $breadcrumbs;
    }