当前位置: 首页>>代码示例>>PHP>>正文


PHP Basic::mkdir方法代码示例

本文整理汇总了PHP中Basic::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP Basic::mkdir方法的具体用法?PHP Basic::mkdir怎么用?PHP Basic::mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Basic的用法示例。


在下文中一共展示了Basic::mkdir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveFile

 /**
  * save file to $dirname and return filename as stored on ftp
  * 
  * @param string
  * @param HttpUploadedFile
  * @param string filename with suffix (usually id from DB)
  * @param bool overwrite older file with given $filename ?
  * @return string
  */
 public static function saveFile($dirname, $file, $filename = NULL, $overwriteOldFile = true)
 {
     // return if no file given [may occur only when editing item otherwise it's controlled when submitting form]
     if (!$file instanceof HttpUploadedFile or empty($file->name)) {
         return null;
     }
     $dirname = Basic::AddLastSlash($dirname);
     Basic::mkdir($dirname);
     if (is_null($filename)) {
         $filename = $file->name;
     }
     $filename = self::handleFilename($filename);
     if (!$overwriteOldFile) {
         $filename = self::getUniqueFilename($dirname, null, $filename);
     }
     $dest = $dirname . $filename;
     $file->move($dest);
     return $filename;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:28,代码来源:FileUploadModel.php

示例2: setWebloaderPaths

 protected function setWebloaderPaths()
 {
     // sets webloader source path to file calling this one ..
     $backtrace = debug_backtrace();
     self::$webloaderSrcPath = $callingFile = dirname($backtrace[0]['file']);
     // sets uri to webtemp control dir
     $webtempDir = Environment::getVariable('webtempDir');
     $baseUri = Environment::getVariable('baseUri');
     $webtempDirSlashed = str_replace('\\', '/', $webtempDir);
     //		$webtempDirname = substr($webtempDirSlashed, strpos($webtempDirSlashed, $baseUri) + strlen($baseUri));
     $webtempDirname = substr($webtempDirSlashed, strlen(WWW_DIR) + 1);
     $controlName = basename(self::$webloaderSrcPath);
     self::$webloaderDestPath = $webtempDir . '/' . $controlName;
     self::$webloaderDestUri = $baseUri . $webtempDirname . '/' . $controlName;
     // create automatically dir for scripts even if not used
     $dest = $webtempDir . '/' . $controlName;
     Basic::mkdir($dest);
     Basic::mkdir($dest . '/js');
     Basic::mkdir($dest . '/css');
 }
开发者ID:radypala,项目名称:maga-website,代码行数:20,代码来源:BaseControl.php

示例3: renderFile

 private static function renderFile(&$loader, $origTempUri, $origTempPath, $key, $files)
 {
     $controlId = basename(substr($key, 0, strpos($key, '||')));
     // ak je to nejaky subor z modulu [vzdy ulozeny v zlozke 'web'], tak chceme zachovat meno podla 3.parametra
     if ($controlId == 'web') {
         $dirname = substr($key, strpos($key, '||') + 2);
         $pathSuffix = Basic::getBaseDirName($dirname);
         $srcPath = str_replace(array('||', $pathSuffix . '/'), array('', ''), $key);
     } else {
         $dirname = $controlId . '/' . substr($key, strpos($key, '||') + 2);
         $srcPath = str_replace('||', '', $key);
     }
     $dirname = String::trim($dirname, '/');
     //todo: overit, ci to nebude robit adresare zase inde..zistit, cim to je, ze to na locale ide a na ostrom serveri nie
     // pouzit ked tak Environment::getVariable('webtempDir')
     Basic::mkdir($origTempPath . '/' . $dirname);
     $loader->sourcePath = $srcPath;
     $loader->tempUri = $origTempUri . '/' . $dirname;
     $loader->tempPath = $origTempPath . '/' . $dirname;
     $loader->render($files);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:21,代码来源:MyWebloader.php

示例4: savePreviewWithThumb

 /**
  * make thumbnail and resize big image storing them in $dirname (and $dirname/thumb) as $filename
  *
  * @param Image
  * @param string
  * @param int
  * @param int
  * @param int
  * @param int
  * @param bool makeThumbnail for big image or just resize proportionally?
  * @param string
  * @return void
  * @throws NotImageException
  */
 public static function savePreviewWithThumb($img, $dirname, $thumb_w, $thumb_h, $big_w, $big_h, $useThumbForBig = false, $filename = 'main.jpg')
 {
     if (!$img instanceof Image) {
         throw new NotImageException('Argument "$img" must be instance of Image, "' . get_class($img) . '" given.');
     }
     Basic::mkdir($dirname);
     Basic::mkdir($dirname . '/thumb');
     $dest = $dirname . '/' . $filename;
     $dest_thumb = $dirname . '/thumb/' . $filename;
     // big one
     $img2 = clone $img;
     // resize only if needed
     if ($img2->getWidth() > $big_w || $img2->getHeight() > $big_h) {
         if ($useThumbForBig) {
             self::makeThumbnail($img2, $big_w, $big_h);
         } else {
             $img2->resize($big_w, $big_h)->sharpen();
         }
     }
     // PNG does not save alpha channel (transparency) by default, needs to be turned on explicitly
     $img2->saveAlpha(true);
     $img2->save($dest, self::$quality);
     self::makeThumbnail($img, $thumb_w, $thumb_h);
     // PNG does not save alpha channel (transparency) by default, needs to be turned on explicitly
     $img->saveAlpha(true);
     $img->save($dest_thumb, self::$quality);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:41,代码来源:ImageModel.php

示例5: saveImages

 /**
  * make thumbnail and resize images storing them in $dirname
  *
  * @param string
  * @param HttpUploadedFile array 
  * @param int
  * @param int
  * @param int
  * @param int
  * @return bool have we uploaded sth?
  * @throws NotImageException
  */
 public static function saveImages($dirname, $files, $thumb_w, $thumb_h, $big_w, $big_h)
 {
     if (count($files) == 0) {
         return false;
     }
     $dirname = Basic::addLastSlash($dirname);
     $dest_big = $dirname . 'big/';
     $dest_thumb = $dirname . 'thumb/';
     Basic::mkdir($dest_big);
     Basic::mkdir($dest_thumb);
     $uploaded = false;
     // move uploaded files .. errors are handled in MyAppForm and MyFileInput already when form is submitted
     foreach ($files as $file) {
         //	ak nezvoli subor, tak skusime dalsi
         if (!$file instanceof HttpUploadedFile or $file->error === UPLOAD_ERR_NO_FILE) {
             continue;
         }
         $filename = $file->getName();
         if (!$file->isImage()) {
             throw new NotImageException('Nahrať možete iba obrázky! Poslaný súbor: ' . $file->name);
         }
         $filename = self::handleFilename($filename);
         $img = $file->toImage();
         $img2 = clone $img;
         self::makeThumbnail($img, $thumb_w, $thumb_h);
         // PNG does not save alpha channel (transparency) by default, needs to be turned on explicitly
         $img->saveAlpha(true);
         $img->save($dest_thumb . $filename, self::$quality);
         //	big one - proportionally
         $img2->resize($big_w, $big_h);
         // PNG does not save alpha channel (transparency) by default, needs to be turned on explicitly
         $img2->saveAlpha(true);
         $img2->save($dest_big . $filename, self::$quality);
         // flag we uploaded sth.
         $uploaded = true;
     }
     return $uploaded;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:50,代码来源:ImageUploadModel.php


注:本文中的Basic::mkdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。