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


PHP File::getFileExtension方法代码示例

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


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

示例1: detect

 /**
  * @param $file
  * @param null $filename
  * @return mixed|string
  * @throws \Exception
  */
 public static function detect($file, $filename = null)
 {
     if (!file_exists($file)) {
         throw new \Exception("File " . $file . " doesn't exist");
     }
     if (!$filename) {
         $filename = basename($file);
     }
     // check for an extension mapping first
     if ($filename) {
         $extension = \Pimcore\File::getFileExtension($filename);
         if (array_key_exists($extension, self::$extensionMapping)) {
             return self::$extensionMapping[$extension];
         }
     }
     // check with fileinfo, if there's no extension mapping
     $finfo = finfo_open(FILEINFO_MIME);
     $type = finfo_file($finfo, $file);
     finfo_close($finfo);
     if ($type !== false && !empty($type)) {
         if (strstr($type, ';')) {
             $type = substr($type, 0, strpos($type, ';'));
         }
         return $type;
     }
     // return default mime-type if we're unable to detect it
     return "application/octet-stream";
 }
开发者ID:sfie,项目名称:pimcore,代码行数:34,代码来源:Mime.php

示例2: scriptProxyAction

 public function scriptProxyAction()
 {
     $this->disableViewAutoRender();
     $allowedFileTypes = ["js", "css"];
     $scripts = explode(",", $this->getParam("scripts"));
     $scriptPath = $this->getParam("scriptPath");
     $scriptsContent = "";
     foreach ($scripts as $script) {
         $filePath = PIMCORE_DOCUMENT_ROOT . $scriptPath . $script;
         if (is_file($filePath) && is_readable($filePath) && in_array(\Pimcore\File::getFileExtension($script), $allowedFileTypes)) {
             $scriptsContent .= file_get_contents($filePath);
         }
     }
     $fileExtension = \Pimcore\File::getFileExtension($scripts[0]);
     $contentType = "text/javascript";
     if ($fileExtension == "css") {
         $contentType = "text/css";
     }
     $lifetime = 86400;
     $this->getResponse()->setHeader("Cache-Control", "max-age=" . $lifetime, true);
     $this->getResponse()->setHeader("Pragma", "", true);
     $this->getResponse()->setHeader("Content-Type", $contentType, true);
     $this->getResponse()->setHeader("Expires", gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT", true);
     echo $scriptsContent;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:25,代码来源:MiscController.php

示例3: locateConfigFile

 /**
  * @param $name
  * @return mixed
  */
 public static function locateConfigFile($name)
 {
     if (!isset(self::$configFileCache[$name])) {
         $pathsToCheck = [PIMCORE_WEBSITE_PATH . "/config", PIMCORE_CONFIGURATION_DIRECTORY];
         $file = PIMCORE_CONFIGURATION_DIRECTORY . "/" . $name;
         // check for environment configuration
         $env = getenv("PIMCORE_ENVIRONMENT");
         if ($env) {
             $fileExt = File::getFileExtension($name);
             $pureName = str_replace("." . $fileExt, "", $name);
             foreach ($pathsToCheck as $path) {
                 $tmpFile = $path . "/" . $pureName . "." . $env . "." . $fileExt;
                 if (file_exists($tmpFile)) {
                     $file = $tmpFile;
                     break;
                 }
             }
         }
         foreach ($pathsToCheck as $path) {
             $tmpFile = $path . "/" . $name;
             if (file_exists($tmpFile)) {
                 $file = $tmpFile;
                 break;
             }
         }
         self::$configFileCache[$name] = $file;
     }
     return self::$configFileCache[$name];
 }
开发者ID:jansarmir,项目名称:pimcore,代码行数:33,代码来源:Config.php

示例4: preparePath

 /**
  * @param $path
  * @return string
  */
 protected function preparePath($path)
 {
     if (!stream_is_local($path)) {
         // gs is only able to deal with local files
         // if your're using custom stream wrappers this wouldn't work, so we create a temp. local copy
         $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/imagick-tmp-" . uniqid() . "." . File::getFileExtension($path);
         copy($path, $tmpFilePath);
         $path = $tmpFilePath;
         $this->tmpFiles[] = $path;
     }
     return $path;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:16,代码来源:Adapter.php

示例5: load

 /**
  * @param $imagePath
  * @param array $options
  * @return $this|self
  */
 public function load($imagePath, $options = [])
 {
     $this->path = $imagePath;
     if (!($this->resource = @imagecreatefromstring(file_get_contents($this->path)))) {
         return false;
     }
     // set dimensions
     list($width, $height) = getimagesize($this->path);
     $this->setWidth($width);
     $this->setHeight($height);
     if (in_array(\Pimcore\File::getFileExtension($imagePath), ["png", "gif"])) {
         // in GD only gif and PNG can have an alphachannel
         $this->setIsAlphaPossible(true);
     }
     $this->setModified(false);
     return $this;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:22,代码来源:GD.php

示例6: load

 /**
  * loads the image by the specified path
  *
  * @param $imagePath
  * @param array $options
  * @return ImageMagick
  */
 public function load($imagePath, $options = [])
 {
     // support image URLs
     if (preg_match("@^https?://@", $imagePath)) {
         $tmpFilename = "imagick_auto_download_" . md5($imagePath) . "." . File::getFileExtension($imagePath);
         $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $tmpFilename;
         $this->tmpFiles[] = $tmpFilePath;
         File::put($tmpFilePath, \Pimcore\Tool::getHttpData($imagePath));
         $imagePath = $tmpFilePath;
     }
     if (!stream_is_local($imagePath)) {
         // imagick is only able to deal with local files
         // if your're using custom stream wrappers this wouldn't work, so we create a temp. local copy
         $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/imagick-tmp-" . uniqid() . "." . File::getFileExtension($imagePath);
         copy($imagePath, $tmpFilePath);
         $imagePath = $tmpFilePath;
         $this->tmpFiles[] = $imagePath;
     }
     $this->imagePath = $imagePath;
     $this->initResource();
     $this->setModified(false);
     return $this;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:30,代码来源:ImageMagick.php

示例7: locateConfigFile

 /**
  * @param $name - name of configuration file. slash is allowed for subdirectories.
  * @return mixed
  */
 public static function locateConfigFile($name)
 {
     if (!isset(self::$configFileCache[$name])) {
         $pathsToCheck = [PIMCORE_CUSTOM_CONFIGURATION_DIRECTORY, PIMCORE_CONFIGURATION_DIRECTORY];
         $file = null;
         // check for environment configuration
         $env = self::getEnvironment();
         if ($env) {
             $fileExt = File::getFileExtension($name);
             $pureName = str_replace("." . $fileExt, "", $name);
             foreach ($pathsToCheck as $path) {
                 $tmpFile = $path . "/" . $pureName . "." . $env . "." . $fileExt;
                 if (file_exists($tmpFile)) {
                     $file = $tmpFile;
                     break;
                 }
             }
         }
         //check for config file without environment configuration
         if (!$file) {
             foreach ($pathsToCheck as $path) {
                 $tmpFile = $path . "/" . $name;
                 if (file_exists($tmpFile)) {
                     $file = $tmpFile;
                     break;
                 }
             }
         }
         //get default path in pimcore configuration directory
         if (!$file) {
             $file = PIMCORE_CONFIGURATION_DIRECTORY . "/" . $name;
         }
         self::$configFileCache[$name] = $file;
     }
     return self::$configFileCache[$name];
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:40,代码来源:Config.php

示例8: isVectorGraphic

 /**
  * @param null $imagePath
  * @return bool
  */
 public function isVectorGraphic($imagePath = null)
 {
     if (!$imagePath) {
         $imagePath = $this->imagePath;
     }
     // we need to do this check first, because ImageMagick using the inkscape delegate returns "PNG" when calling
     // getimageformat() onto SVG graphics, this is a workaround to avoid problems
     if (in_array(File::getFileExtension($imagePath), ["svg", "svgz", "eps", "pdf", "ps"])) {
         // use file-extension if filename is provided
         return true;
     }
     try {
         $type = $this->resource->getimageformat();
         $vectorTypes = array("EPT", "EPDF", "EPI", "EPS", "EPS2", "EPS3", "EPSF", "EPSI", "EPT", "PDF", "PFA", "PFB", "PFM", "PS", "PS2", "PS3", "SVG", "SVGZ", "MVG");
         if (in_array(strtoupper($type), $vectorTypes)) {
             return true;
         }
     } catch (\Exception $e) {
         \Logger::err($e);
     }
     return false;
 }
开发者ID:pokleh,项目名称:pimcore,代码行数:26,代码来源:Imagick.php

示例9: getImageThumbnailAction

 public function getImageThumbnailAction()
 {
     $fileinfo = $this->getParam("fileinfo");
     $image = Asset\Image::getById(intval($this->getParam("id")));
     $thumbnail = null;
     if ($this->getParam("thumbnail")) {
         $thumbnail = $image->getThumbnailConfig($this->getParam("thumbnail"));
     }
     if (!$thumbnail) {
         if ($this->getParam("config")) {
             $thumbnail = $image->getThumbnailConfig(\Zend_Json::decode($this->getParam("config")));
         } else {
             $thumbnail = $image->getThumbnailConfig($this->getAllParams());
         }
     } else {
         // no high-res images in admin mode (editmode)
         // this is mostly because of the document's image editable, which doesn't know anything about the thumbnail
         // configuration, so the dimensions would be incorrect (double the size)
         $thumbnail->setHighResolution(1);
     }
     $format = strtolower($thumbnail->getFormat());
     if ($format == "source" || $format == "print") {
         $thumbnail->setFormat("PNG");
         $format = "png";
     }
     if ($this->getParam("treepreview")) {
         $thumbnail = Asset\Image\Thumbnail\Config::getPreviewConfig();
     }
     if ($this->getParam("cropPercent")) {
         $thumbnail->addItemAt(0, "cropPercent", array("width" => $this->getParam("cropWidth"), "height" => $this->getParam("cropHeight"), "y" => $this->getParam("cropTop"), "x" => $this->getParam("cropLeft")));
         $hash = md5(Tool\Serialize::serialize($this->getAllParams()));
         $thumbnail->setName($thumbnail->getName() . "_auto_" . $hash);
     }
     if ($this->getParam("download")) {
         $downloadFilename = str_replace("." . File::getFileExtension($image->getFilename()), "." . $thumbnail->getFormat(), $image->getFilename());
         $downloadFilename = strtolower($downloadFilename);
         header('Content-Disposition: attachment; filename="' . $downloadFilename . '"');
     }
     $thumbnail = $image->getThumbnail($thumbnail);
     if ($fileinfo) {
         $this->_helper->json(array("width" => $thumbnail->getWidth(), "height" => $thumbnail->getHeight()));
     }
     $thumbnailFile = PIMCORE_DOCUMENT_ROOT . $thumbnail;
     $fileExtension = File::getFileExtension($thumbnailFile);
     if (in_array($fileExtension, array("gif", "jpeg", "jpeg", "png", "pjpeg"))) {
         header("Content-Type: image/" . $fileExtension, true);
     } else {
         header("Content-Type: " . $image->getMimetype(), true);
     }
     header("Content-Length: " . filesize($thumbnailFile), true);
     $this->sendThumbnailCacheHeaders();
     while (@ob_end_flush()) {
     }
     flush();
     readfile($thumbnailFile);
     exit;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:57,代码来源:AssetController.php

示例10: getSaveCopyName

 /**
  * Returns a uniqe key for the element in the $target-Path (recursive)
  * @static
  * @return ElementInterface|string
  * @param string $type
  * @param string $sourceKey
  * @param ElementInterface $target
  */
 public static function getSaveCopyName($type, $sourceKey, $target)
 {
     if (self::pathExists($target->getFullPath() . "/" . $sourceKey, $type)) {
         // only for assets: add the prefix _copy before the file extension (if exist) not after to that source.jpg will be source_copy.jpg and not source.jpg_copy
         if ($type == "asset" && ($fileExtension = File::getFileExtension($sourceKey))) {
             $sourceKey = str_replace("." . $fileExtension, "_copy." . $fileExtension, $sourceKey);
         } else {
             $sourceKey .= "_copy";
         }
         return self::getSaveCopyName($type, $sourceKey, $target);
     }
     return $sourceKey;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:21,代码来源:Service.php

示例11: getText

 /**
  * @param null $page
  * @param null $path
  * @return bool|string
  * @throws \Exception
  */
 public function getText($page = null, $path = null)
 {
     $path = $path ? $this->preparePath($path) : $this->path;
     if ($page || parent::isFileTypeSupported($path)) {
         // for per page extraction we have to convert the document to PDF and extract the text via ghostscript
         return parent::getText($page, $this->getPdf($path));
     } elseif (File::getFileExtension($path)) {
         // if we want to get the text of the whole document, we can use libreoffices text export feature
         $cmd = self::getLibreOfficeCli() . " --headless --nologo --nofirststartwizard --norestore --convert-to txt:Text --outdir " . escapeshellarg(PIMCORE_TEMPORARY_DIRECTORY) . " " . escapeshellarg($path);
         $out = Console::exec($cmd, null, 240);
         Logger::debug("LibreOffice Output was: " . $out);
         $tmpName = PIMCORE_TEMPORARY_DIRECTORY . "/" . preg_replace("/\\." . File::getFileExtension($path) . "\$/", ".txt", basename($path));
         if (file_exists($tmpName)) {
             $text = file_get_contents($tmpName);
             $text = \Pimcore\Tool\Text::convertToUTF8($text);
             unlink($tmpName);
             return $text;
         } else {
             $message = "Couldn't convert document to PDF: " . $path . " with the command: '" . $cmd . "' - now trying to get the text out of the PDF ...";
             Logger::error($message);
             return parent::getText(null, $this->getPdf($path));
         }
     }
     return "";
     // default empty string
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:32,代码来源:LibreOffice.php

示例12: process

 /**
  * @param $asset
  * @param Config $config
  * @param null $fileSystemPath
  * @param bool $deferred deferred means that the image will be generated on-the-fly (details see below)
  * @return mixed|string
  */
 public static function process($asset, Config $config, $fileSystemPath = null, $deferred = false)
 {
     $format = strtolower($config->getFormat());
     $contentOptimizedFormat = false;
     if (!$fileSystemPath && $asset instanceof Asset) {
         $fileSystemPath = $asset->getFileSystemPath();
     }
     if ($asset instanceof Asset) {
         $id = $asset->getId();
     } else {
         $id = "dyn~" . crc32($fileSystemPath);
     }
     if (!file_exists($fileSystemPath)) {
         return "/pimcore/static/img/filetype-not-supported.png";
     }
     $modificationDate = filemtime($fileSystemPath);
     $fileExt = File::getFileExtension(basename($fileSystemPath));
     // simple detection for source type if SOURCE is selected
     if ($format == "source" || empty($format)) {
         $format = self::getAllowedFormat($fileExt, array("jpeg", "gif", "png"), "png");
         $contentOptimizedFormat = true;
         // format can change depending of the content (alpha-channel, ...)
     }
     if ($format == "print") {
         $format = self::getAllowedFormat($fileExt, array("svg", "jpeg", "png", "tiff"), "png");
         if (($format == "tiff" || $format == "svg") && \Pimcore\Tool::isFrontentRequestByAdmin()) {
             // return a webformat in admin -> tiff cannot be displayed in browser
             $format = "png";
         } else {
             if ($format == "tiff") {
                 $transformations = $config->getItems();
                 if (is_array($transformations) && count($transformations) > 0) {
                     foreach ($transformations as $transformation) {
                         if (!empty($transformation)) {
                             if ($transformation["method"] == "tifforiginal") {
                                 return str_replace(PIMCORE_DOCUMENT_ROOT, "", $fileSystemPath);
                             }
                         }
                     }
                 }
             } else {
                 if ($format == "svg") {
                     return str_replace(PIMCORE_DOCUMENT_ROOT, "", $fileSystemPath);
                 }
             }
         }
     }
     $thumbDir = $asset->getImageThumbnailSavePath() . "/thumb__" . $config->getName();
     $filename = preg_replace("/\\." . preg_quote(File::getFileExtension($asset->getFilename())) . "/", "", $asset->getFilename());
     // add custom suffix if available
     if ($config->getFilenameSuffix()) {
         $filename .= "~-~" . $config->getFilenameSuffix();
     }
     // add high-resolution modifier suffix to the filename
     if ($config->getHighResolution() > 1) {
         $filename .= "@" . $config->getHighResolution() . "x";
     }
     $filename .= "." . $format;
     $fsPath = $thumbDir . "/" . $filename;
     if (!is_dir(dirname($fsPath))) {
         File::mkdir(dirname($fsPath));
     }
     $path = str_replace(PIMCORE_DOCUMENT_ROOT, "", $fsPath);
     // check for existing and still valid thumbnail
     if (is_file($fsPath) and filemtime($fsPath) >= $modificationDate) {
         return $path;
     }
     // deferred means that the image will be generated on-the-fly (when requested by the browser)
     // the configuration is saved for later use in Pimcore\Controller\Plugin\Thumbnail::routeStartup()
     // so that it can be used also with dynamic configurations
     if ($deferred) {
         $configId = "thumb_" . $id . "__" . md5($path);
         TmpStore::add($configId, $config, "thumbnail_deferred");
         return $path;
     }
     // transform image
     $image = Asset\Image::getImageTransformInstance();
     if (!$image->load($fileSystemPath)) {
         return "/pimcore/static/img/filetype-not-supported.png";
     }
     $image->setUseContentOptimizedFormat($contentOptimizedFormat);
     $startTime = StopWatch::microtime_float();
     $transformations = $config->getItems();
     // check if the original image has an orientation exif flag
     // if so add a transformation at the beginning that rotates and/or mirrors the image
     if (function_exists("exif_read_data")) {
         $exif = @exif_read_data($fileSystemPath);
         if (is_array($exif)) {
             if (array_key_exists("Orientation", $exif)) {
                 $orientation = intval($exif["Orientation"]);
                 if ($orientation > 1) {
                     $angleMappings = [2 => 180, 3 => 180, 4 => 180, 5 => 90, 6 => 90, 7 => 90, 8 => 270];
                     if (array_key_exists($orientation, $angleMappings)) {
//.........这里部分代码省略.........
开发者ID:kwoun1982,项目名称:pimcore,代码行数:101,代码来源:Processor.php

示例13: getFileExtension

 /**
  * @return string
  */
 public function getFileExtension()
 {
     $mapping = ["image/png" => "png", "image/jpeg" => "jpg", "image/gif" => "gif", "image/tiff" => "tif", "image/svg+xml" => "svg"];
     $mimeType = $this->getMimeType();
     if (isset($mapping[$mimeType])) {
         return $mapping[$mimeType];
     }
     if ($this->getAsset()) {
         return \Pimcore\File::getFileExtension($this->getAsset()->getFilename());
     }
     return "";
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:15,代码来源:Thumbnail.php

示例14: wordExportDownloadAction

 public function wordExportDownloadAction()
 {
     $id = $this->getParam("id");
     $exportFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $id . ".html";
     // add closing body/html
     //$f = fopen($exportFile, "a+");
     //fwrite($f, "</body></html>");
     //fclose($f);
     // should be done via Pimcore_Document(_Adapter_LibreOffice) in the future
     if (\Pimcore\Document::isFileTypeSupported("docx")) {
         $lockKey = "soffice";
         Model\Tool\Lock::acquire($lockKey);
         // avoid parallel conversions of the same document
         $out = Tool\Console::exec(\Pimcore\Document\Adapter\LibreOffice::getLibreOfficeCli() . ' --headless --convert-to docx:"Office Open XML Text" --outdir ' . PIMCORE_TEMPORARY_DIRECTORY . " " . $exportFile);
         \Logger::debug("LibreOffice Output was: " . $out);
         $tmpName = PIMCORE_TEMPORARY_DIRECTORY . "/" . preg_replace("/\\." . File::getFileExtension($exportFile) . "\$/", ".docx", basename($exportFile));
         Model\Tool\Lock::release($lockKey);
         // end what should be done in Pimcore_Document
         header("Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document");
         header('Content-Disposition: attachment; filename="' . basename($tmpName) . '"');
     } else {
         // no conversion, output html file
         $tmpName = $exportFile;
         header("Content-Type: text/html");
         header('Content-Disposition: attachment; filename="' . basename($tmpName) . '"');
     }
     while (@ob_end_flush()) {
     }
     flush();
     readfile($tmpName);
     @unlink($exportFile);
     @unlink($tmpName);
     exit;
 }
开发者ID:quorak,项目名称:pimcore,代码行数:34,代码来源:TranslationController.php

示例15: save

 /**
  * @param $path
  * @param null $format
  * @param null $quality
  * @return $this|mixed
  * @throws \Exception
  */
 public function save($path, $format = null, $quality = null)
 {
     if (!$format) {
         $format = "png32";
     }
     $format = strtolower($format);
     if ($format == "png") {
         // we need to force imagick to create png32 images, otherwise this can cause some strange effects
         // when used with gray-scale images
         $format = "png32";
     }
     if ($format == "original") {
         $format = strtolower($this->resource->getImageFormat());
     }
     $originalFilename = null;
     if (!$this->reinitializing) {
         if ($this->getUseContentOptimizedFormat()) {
             $format = "jpeg";
             if ($this->hasAlphaChannel()) {
                 $format = "png32";
             }
         }
     }
     $i = $this->resource;
     // this is because of HHVM which has problems with $this->resource->writeImage();
     if (in_array($format, ["jpeg", "pjpeg", "jpg"]) && $this->isAlphaPossible) {
         // set white background for transparent pixels
         $i->setImageBackgroundColor("#ffffff");
         // Imagick version compatibility
         $alphaChannel = 11;
         // This works at least as far back as version 3.1.0~rc1-1
         if (defined("Imagick::ALPHACHANNEL_REMOVE")) {
             // Imagick::ALPHACHANNEL_REMOVE has been added in 3.2.0b2
             $alphaChannel = \Imagick::ALPHACHANNEL_REMOVE;
         }
         $i->setImageAlphaChannel($alphaChannel);
         $i->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
     }
     if (!$this->isPreserveMetaData()) {
         $i->stripImage();
     }
     if (!$this->isPreserveColor()) {
         $i->profileImage('*', null);
     }
     $i->setImageFormat($format);
     if ($quality && !$this->isPreserveColor()) {
         $i->setCompressionQuality((int) $quality);
         $i->setImageCompressionQuality((int) $quality);
     }
     if ($format == "tiff") {
         $i->setCompression(\Imagick::COMPRESSION_LZW);
     }
     // force progressive JPEG if filesize >= 10k
     // normally jpeg images are bigger than 10k so we avoid the double compression (baseline => filesize check => if necessary progressive)
     // and check the dimensions here instead to faster generate the image
     // progressive JPEG - better compression, smaller filesize, especially for web optimization
     if ($format == "jpeg" && !$this->isPreserveColor()) {
         if ($this->getWidth() * $this->getHeight() > 35000) {
             $i->setInterlaceScheme(\Imagick::INTERLACE_PLANE);
         }
     }
     // Imagick isn't able to work with custom stream wrappers, so we make a workaround
     $realTargetPath = null;
     if (!stream_is_local($path)) {
         $realTargetPath = $path;
         $path = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/imagick-tmp-" . uniqid() . "." . File::getFileExtension($path);
     }
     if (defined("HHVM_VERSION")) {
         $success = $i->writeImage($path);
     } else {
         $success = $i->writeImage($format . ":" . $path);
     }
     if (!$success) {
         throw new \Exception("Unable to write image: ", $path);
     }
     if ($realTargetPath) {
         File::rename($path, $realTargetPath);
     }
     return $this;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:87,代码来源:Imagick.php


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