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


PHP File::__construct方法代码示例

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


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

示例1: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($path, $checkPath = true)
 {
     parent::__construct($path, $checkPath);
     if (false === strpos($this->getMimeType(), 'image')) {
         throw new \Exception(sprintf('Is not an image file. (%s)', $this->getMimeType()));
     }
 }
开发者ID:Antoad,项目名称:GenemuFormBundle,代码行数:10,代码来源:Image.php

示例2: __construct

 public function __construct($path)
 {
     try {
         parent::__construct($path, true);
     } catch (SFFileNotFoundException $e) {
         throw new FileNotFoundException(sprintf('File %s not found', $path));
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:File.php

示例3: __construct

 /**
  * @param string $path
  * @param bool   $checkPath
  *
  * @throws RuntimeException
  */
 public function __construct($path, $checkPath = true)
 {
     parent::__construct($path, $checkPath);
     if (0 !== strpos($this->getMimeType(), 'image/')) {
         $message = sprintf('File %s is not an image; Avalanche operates only on images', $path);
         throw new RuntimeException($message);
     }
 }
开发者ID:jmcclell,项目名称:AvalancheImagineBundle,代码行数:14,代码来源:ImageFile.php

示例4: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($handle)
 {
     if (!is_resource($handle)) {
         throw new \RuntimeException('handle is not a resource');
     }
     $this->resource = $handle;
     $meta = stream_get_meta_data($handle);
     parent::__construct($meta['uri']);
 }
开发者ID:sidz,项目名称:SonataMediaBundle,代码行数:12,代码来源:ApiMediaFile.php

示例5: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($path, $checkPath = true)
 {
     parent::__construct($path, $checkPath);
     if (false === strpos($this->getMimeType(), 'image')) {
         throw new \Exception(sprintf('Is not a image file. (%s)', $this->getMimeType()));
     }
     $format = $this->checkFormat($this->guessExtension());
     $generate = 'imagecreatefrom' . $format;
     $this->gd = new Gd();
     $this->gd->setResource($generate($this->getPathname()));
 }
开发者ID:hykz,项目名称:Depot,代码行数:14,代码来源:Image.php

示例6: __construct

 /**
  * Constructs a new file from the given path.
  *
  * @param string|SplFileInfo $pathOrFile
  * @param string $original_name
  *
  */
 public function __construct($pathOrFile, $original_name)
 {
     $this->original_name = $original_name;
     if ($pathOrFile instanceof SplFileInfo) {
         parent::__construct($pathOrFile->getRealPath(), false);
     } elseif (is_string($pathOrFile)) {
         parent::__construct($pathOrFile, true);
     } else {
         throw new UnexpectedValueException('Input value must be string or SplFileInfo');
     }
 }
开发者ID:Somethingideally,项目名称:generic-file,代码行数:18,代码来源:File.php

示例7: __construct

 /**
  * Accepts the information of the uploaded file as provided by the PHP global $_FILES.
  *
  * @param string  $path         The full temporary path to the file
  * @param string  $originalName The original file name
  * @param string  $mimeType     The type of the file as provided by PHP
  * @param integer $size         The file size
  * @param integer $error        The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants)
  * @param Boolean $test         Whether the test mode is active
  *
  * @throws FileException         If file_uploads is disabled
  * @throws FileNotFoundException If the file does not exist
  */
 public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false)
 {
     if (!ini_get('file_uploads')) {
         throw new FileException(sprintf('Unable to create UploadedFile because "file_uploads" is disabled in your php.ini file (%s)', get_cfg_var('cfg_file_path')));
     }
     $this->originalName = basename($originalName);
     $this->mimeType = $mimeType ?: 'application/octet-stream';
     $this->size = $size;
     $this->error = $error ?: UPLOAD_ERR_OK;
     $this->test = (bool) $test;
     parent::__construct($path);
 }
开发者ID:nightchiller,项目名称:symfony,代码行数:25,代码来源:UploadedFile.php

示例8: __construct

 public function __construct($base64Content, $originalName, $mimeType = null, $size = null)
 {
     $this->originalName = $this->getName($originalName);
     $this->mimeType = $mimeType ?: 'application/octet-stream';
     $this->size = $size;
     $filePath = tempnam(sys_get_temp_dir(), 'streetartlas_');
     $file = fopen($filePath, 'wb');
     $data = explode(',', $base64Content);
     fwrite($file, base64_decode($data[1]));
     $meta_data = stream_get_meta_data($file);
     $path = $meta_data['uri'];
     fclose($file);
     parent::__construct($path, true);
 }
开发者ID:jahller,项目名称:streetartlas,代码行数:14,代码来源:ApiUploadedFile.php

示例9: __construct

 public function __construct($realpath, $path)
 {
     $this->realpath = $realpath;
     parent::__construct($path, false);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:5,代码来源:FakeFile.php

示例10: __construct

 /**
  * @param string $encoded
  * @param bool   $strict
  * @param bool   $checkPath
  */
 public function __construct($encoded, $strict = true, $checkPath = true)
 {
     parent::__construct($this->restoreToTemporary($encoded, $strict), $checkPath);
 }
开发者ID:hshn,项目名称:base64-encoded-file,代码行数:9,代码来源:Base64EncodedFile.php

示例11: __construct

 /**
  * Constructs a new file from the given path.
  *
  * @param string $path      The path to the file
  * @param bool   $checkPath Whether to check the path or not
  *
  * @throws FileNotFoundException If the given path is not a file
  */
 public function __construct($path, $checkPath = true)
 {
     $this->getID3Info = new getID3();
     parent::__construct($path, $checkPath);
 }
开发者ID:redooor,项目名称:redminportal,代码行数:13,代码来源:File.php

示例12: __construct

 public function __construct($root_path, $web_path)
 {
     $this->root_path = $root_path;
     $this->web_path = $web_path;
     parent::__construct($root_path . $web_path);
 }
开发者ID:it-blaster,项目名称:uploadable-bundle,代码行数:6,代码来源:UploadableFile.php


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