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


PHP file::move方法代码示例

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


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

示例1: uploadFile2

 /**
  * @ORM\PostPersist
  */
 public function uploadFile2()
 {
     if (null === $this->file2) {
         return;
     } else {
         $this->file2->move(__DIR__ . '/../../../app/uploads' . $this->getUploadDir(), $this->second_fichier);
         unset($this->file2);
     }
 }
开发者ID:WildCodeSchool,项目名称:partnet,代码行数:12,代码来源:Formations.php

示例2: upload

 /**
  * @ORM\PostPersist
  */
 public function upload()
 {
     if (null === $this->file) {
         return;
     }
     // if there is an error when moving the file, an exception will
     // be automatically thrown by move(). This will properly prevent
     // the entity from being persisted to the database on error
     $this->file->move($this->getUploadRootDir(), $this->photo);
     unset($this->file);
 }
开发者ID:WildCodeSchool,项目名称:partnet,代码行数:14,代码来源:Organisme.php

示例3: save

 /**
  * Override base method.
  */
 public function save()
 {
     if (isset($this->file)) {
         $fileName = $this->entityId . '_' . $this->fieldId . '.' . $this->file->getClientOriginalExtension();
         $this->value = $fileName;
         $this->file->move(public_path() . config('asgard.dynamicfield.config.files-path'), $fileName);
     }
     parent::save();
 }
开发者ID:stone-lab,项目名称:Dynamicfield,代码行数:12,代码来源:File.php

示例4: upload

 public function upload()
 {
     // var_dump(pathinfo($this->file, PATHINFO_EXTENSION));die();
     if (null === $this->file) {
         return false;
     } else {
         $this->path = sha1(uniqid(mt_rand(), true)) . '.' . $this->file->guessExtension();
     }
     $this->file->move($this->getUploadRootDir(), $this->path);
     unset($this->file);
     return true;
 }
开发者ID:gitter-badger,项目名称:Doctors,代码行数:12,代码来源:image.php

示例5: upload

 /**
  * @ORM\PostPersist()
  * @ORM\PostUpdate()
  */
 public function upload()
 {
     if (null === $this->file) {
         return;
     }
     // s'il y a une erreur lors du déplacement du fichier, une exception
     // va automatiquement être lancée par la méthode move(). Cela va empêcher
     // proprement l'entité d'être persistée dans la base de données si
     // erreur il y a
     $this->file->move($this->getUploadRootDir(), $this->photo);
     unset($this->file);
 }
开发者ID:ronaldodia,项目名称:recrutementbeta,代码行数:16,代码来源:Candidat.php

示例6: build


//.........这里部分代码省略.........
                     if ($this->resize(array('w' => $this->cfg->w, 'h' => $this->cfg->h, 'bgColor' => $this->cfg->bgColor, 'fit' => $this->cfg->fit, 'useMaxResize' => $this->cfg->useMaxResize))) {
                         // Save the new size
                         $this->cfg->wAct = imagesx($this->imgAct);
                         $this->cfg->hAct = imagesy($this->imgAct);
                         if ($this->cfg->w || $this->cfg->h) {
                             $change = true;
                         }
                     }
                 }
             }
             if (!empty($this->cfg->filters) && function_exists('imagefilter')) {
                 foreach ($this->cfg->filters as $prms) {
                     if (!is_array($prms)) {
                         $f = $prms;
                         $prms = array();
                     } else {
                         $f = array_shift($prms);
                     }
                     switch (count($prms)) {
                         case 0:
                             imagefilter($this->imgAct, $f);
                             break;
                         case 1:
                             imagefilter($this->imgAct, $f, $prms[0]);
                             break;
                         case 2:
                             imagefilter($this->imgAct, $f, $prms[0], $prms[1]);
                             break;
                         case 3:
                             imagefilter($this->imgAct, $f, $prms[0], $prms[1], $prms[2]);
                             break;
                         default:
                             imagefilter($this->imgAct, $f, $prms[0], $prms[1], $prms[2], $prms[3]);
                             break;
                     }
                 }
             }
             if ($this->cfg->grayFilter) {
                 // Copy form $img to $imgDst With the parameter defined, with grayscale
                 if (function_exists('imagefilter')) {
                     imagefilter($this->imgAct, IMG_FILTER_GRAYSCALE);
                 } else {
                     // Manual Grayscale
                     $imgTmp = $this->imgAct;
                     $x = imagesx($imgTmp);
                     $y = imagesy($imgTmp);
                     $this->imgAct = imagecreatetruecolor($x, $y);
                     imagecolorallocate($this->imgAct, 0, 0, 0);
                     for ($i = 0; $i < $x; $i++) {
                         for ($j = 0; $j < $y; $j++) {
                             $rgb = imagecolorat($imgTmp, $i, $j);
                             $r = $rgb >> 16 & 0xff;
                             $g = $rgb >> 8 & 0xff;
                             $b = $rgb & 0xff;
                             $color = max(array($r, $g, $b));
                             imagesetpixel($this->imgAct, $i, $j, imagecolorexact($this->imgAct, $color, $color, $color));
                         }
                     }
                     imagedestroy($imgTmp);
                 }
             }
             if (!empty($this->cfg->mask) && file::exists($this->cfg->mask)) {
                 $this->mask($this->cfg->mask);
                 $change = true;
             }
             if (!empty($this->cfg->watermarks) && is_array($this->cfg->watermarks)) {
                 foreach ($this->cfg->watermarks as $watermark) {
                     $tmp = $this->watermark($watermark);
                     $change = $change || $tmp;
                 }
             }
             $ret = null;
             if (!$change) {
                 $this->cfg->fileSave = $this->cfg->file;
             }
             if (!empty($this->cfg->fileSave)) {
                 if ($change) {
                     if ($this->save($this->cfg->fileSave)) {
                         $ret = $this->cfg->fileSave;
                     }
                 } else {
                     if ($this->cfg->file != $this->cfg->fileSave) {
                         file::move($this->cfg->file, $this->cfg->fileSave);
                     }
                     $ret = $this->cfg->fileSave;
                 }
             }
             if ($this->cfg->html) {
                 $ret = $this->html();
             }
         } else {
             if ($this->cfg->html) {
                 $ret = $this->html();
             } else {
                 $ret = $this->cfg->fileSave;
             }
         }
     }
     return $ret;
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:101,代码来源:image.class.php


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