本文整理匯總了PHP中Illuminate\Support\Facades\File::isDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::isDirectory方法的具體用法?PHP File::isDirectory怎麽用?PHP File::isDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::isDirectory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRename
/**
* @return string
*/
public function getRename()
{
$old_name = Input::get('file');
$new_name = Input::get('new_name');
$file_path = parent::getPath('directory');
$thumb_path = parent::getPath('thumb');
$old_file = $file_path . $old_name;
if (!File::isDirectory($old_file)) {
$extension = File::extension($old_file);
$new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
}
$new_file = $file_path . $new_name;
if (File::exists($new_file)) {
return Lang::get('laravel-filemanager::lfm.error-rename');
}
if (File::isDirectory($old_file)) {
File::move($old_file, $new_file);
return 'OK';
}
File::move($old_file, $new_file);
if ('Images' === $this->file_type) {
File::move($thumb_path . $old_name, $thumb_path . $new_name);
}
return 'OK';
}
示例2: getRename
/**
* @return string
*/
public function getRename()
{
$old_name = Input::get('file');
$new_name = trim(Input::get('new_name'));
$file_path = parent::getPath('directory');
$thumb_path = parent::getPath('thumb');
$old_file = $file_path . $old_name;
if (!File::isDirectory($old_file)) {
$extension = File::extension($old_file);
$new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
}
$new_file = $file_path . $new_name;
if (Config::get('lfm.alphanumeric_directory') && preg_match('/[^\\w-]/i', $new_name)) {
return Lang::get('laravel-filemanager::lfm.error-folder-alnum');
} elseif (File::exists($new_file)) {
return Lang::get('laravel-filemanager::lfm.error-rename');
}
if (File::isDirectory($old_file)) {
File::move($old_file, $new_file);
Event::fire(new FolderWasRenamed($old_file, $new_file));
return 'OK';
}
File::move($old_file, $new_file);
if ('Images' === $this->file_type) {
File::move($thumb_path . $old_name, $thumb_path . $new_name);
}
Event::fire(new ImageWasRenamed($old_file, $new_file));
return 'OK';
}
示例3: checkDirectory
protected function checkDirectory($namespace, $routePath)
{
$rootPath = config('routie.path');
$routePath = isset($namespace) ? $rootPath . '/' . $routePath : $rootPath;
if (!File::isDirectory($routePath)) {
File::makeDirectory($routePath, 0775, true);
}
return $routePath;
}
示例4: registerNamespaces
private function registerNamespaces()
{
if (File::isDirectory(app_path() . '/config/packages/andywer/js-localization')) {
Config::addNamespace('js-localization', app_path() . '/config/packages/andywer/js-localization');
} else {
Config::addNamespace('js-localization', __DIR__ . '/../config');
}
View::addNamespace('js-localization', __DIR__ . '/../views');
}
示例5: test_with_alpha3_lowercase_names
public function test_with_alpha3_lowercase_names()
{
$exitCode = Artisan::call('prep:country-flags', ['--name' => 2, '--case' => 'lower']);
$this->assertEquals(0, $exitCode, 'Assert exit code is 0');
$this->assertTrue(File::isDirectory($this->dest), 'Assert flags directory was created');
$files = File::files($this->dest);
$this->assertContains($this->dest . '/ukr.svg', $files, 'Assert img files were created with appropriate naming conventions');
$this->assertGreaterThan(200, count($files), 'Assert that count of generated flags is in expected range');
}
示例6: getCachePathOf
/**
* Get the path where an image will be cached
*
* @param Image $image
*
* @return string
*/
public function getCachePathOf(Image $image)
{
$hash = $this->getHashOf($image);
$cacheFolder = $this->illuminage->getCacheFolder();
$hashedFolder = $cacheFolder . $this->getHashedPath($hash);
if ($hashedFolder and !File::isDirectory($hashedFolder)) {
@File::makeDirectory($hashedFolder, 511, true);
}
return $hashedFolder . $hash;
}
示例7: createSizeFolder
/**
* Хэмжээтэй хавтаснуудыг үүсээгүй байвал үүсгэнэ.
*
* @return void
*/
private function createSizeFolder($size_name)
{
$p = $this->basePath . $size_name;
if (!File::isDirectory($p)) {
mkdir($p);
}
$p .= "/" . $this->folder;
if (!File::isDirectory($p)) {
mkdir($p);
}
}
示例8: findFiles
/**
* @param $path
* @param $fileName
* @return array
*/
public function findFiles($path, $fileName)
{
if ($path == '') {
$path = base_path();
}
if (File::isDirectory($path)) {
$path = str_finish($path, '/');
}
$path .= $fileName;
return File::glob($path);
}
示例9: __construct
/**
* @param ImageUploader $uploader
*/
public function __construct(ImageUploader $uploader)
{
$this->uploader = $uploader;
$this->uploadDirectory = public_path() . '/' . config('html_template_curator.upload_directory_name') . '/';
// Check if uploads folder exists and create if not
if (!File::isDirectory($this->uploadDirectory)) {
File::makeDirectory($this->uploadDirectory, 0755, true, true);
}
// Check if folder for storing images and temp dir exists and create if not
if (!File::isDirectory($this->uploadDirectory . 'images/temp/')) {
File::makeDirectory($this->uploadDirectory . 'images/temp/', 0755, true, true);
}
}
示例10: updateSpartan
public function updateSpartan($account, $size = 512)
{
$spartan = $this->_getSpartanImage($account, $size);
if ($spartan == null) {
return;
}
$base = 'uploads/h5/';
// Create directory
if (!File::isDirectory(public_path($base . $account->seo))) {
File::makeDirectory(public_path($base . $account->seo), 0755, true);
}
$spartan->save(public_path($base . $account->seo . "/" . 'spartan.png'));
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(CoursesRequest $request)
{
$course = Course::create($request->all());
$pathToCourse = storage_path() . '/courses/';
echo $pathToCourse;
if (!File::isDirectory($pathToCourse)) {
File::makeDirectory($pathToCourse);
}
File::makeDirectory($pathToCourse . $course->slug);
$course->path_to_material = $pathToCourse . $course->slug;
$course->save();
return redirect('courses');
}
示例12: uploadToLocal
private static function uploadToLocal($fileName, $file, $imagesdir)
{
$inputDir = Config::get('astroanu.imagecache.paths.input');
if (!File::isDirectory($inputDir)) {
File::makeDirectory($inputDir);
}
$destDir = $inputDir . '/' . $imagesdir;
if (!File::isDirectory($destDir)) {
File::makeDirectory($destDir);
}
$image = $file->move($destDir, $fileName);
return $fileName;
}
示例13: resize
public function resize($width, $height)
{
$useStorage = Config::get('astroanu.imagecache.usestorage');
if ($useStorage) {
$inputDisk = Storage::disk(Config::get('astroanu.imagecache.paths.input'));
$outputDisk = Storage::disk(Config::get('astroanu.imagecache.paths.output'));
if (!$inputDisk->exists($this->folder . '/' . $this->filename)) {
return false;
}
if (is_null($width) || is_null($height)) {
return $this->imagine->load($inputDisk->get($this->folder . '/' . $this->filename))->show('jpg');
}
if ($outputDisk->exists($this->folder . '/' . $this->filename)) {
return $this->imagine->load($outputDisk->get($this->folder . '/' . $this->filename))->show('jpg');
}
$size = new \Imagine\Image\Box($width, $height);
$mode = \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND;
if (!$outputDisk->exists($this->folder)) {
$outputDisk->makeDirectory($this->folder);
}
$tmp = storage_path() . '\\tmp_' . $this->filename;
$this->outputFile = $this->folder . '/' . $width . '-' . $height . '_' . $this->filename;
$tmpImage = $this->imagine->load($inputDisk->get($this->folder . '/' . $this->filename))->thumbnail($size, $mode)->save($tmp, array('quality' => Config::get('astroanu.imagecache.defaults.jpgquality')));
$outputDisk->put($this->outputFile, File::get($tmp));
unlink($tmp);
return $this->imagine->load($outputDisk->get($this->outputFile))->show('jpg');
} else {
// to be removed
$outputDir = Config::get('astroanu.imagecache.paths.output') . '/' . $this->folder;
$inputDir = Config::get('astroanu.imagecache.paths.input') . '/' . $this->folder;
$inputFile = $inputDir . '/' . $this->filename;
if (!file_exists($inputFile)) {
return false;
}
if (is_null($width) || is_null($height)) {
return $this->imagine->open($inputFile)->show('jpg');
}
$this->outputFile = $outputDir . '/' . $width . '-' . $height . '_' . $this->filename;
if (File::isFile($this->outputFile)) {
return $this->imagine->open($this->outputFile)->show('jpg');
}
$size = new \Imagine\Image\Box($width, $height);
$mode = \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND;
if (!File::isDirectory($outputDir)) {
File::makeDirectory($outputDir);
}
return $this->imagine->open($inputFile)->thumbnail($size, $mode)->save($this->outputFile, array('quality' => Config::get('astroanu.imagecache.defaults.jpgquality')))->show('jpg');
}
}
示例14: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$response = $next($request);
// HTML cache
if (!$response->isRedirection() && $request->isMethod('get') && !Auth::check() && !config('app.debug') && config('typicms.html_cache')) {
if ($this->hasPageThatShouldNotBeCached($response)) {
return $response;
}
$directory = public_path() . '/html' . $request->getPathInfo();
if (!File::isDirectory($directory)) {
File::makeDirectory($directory, 0777, true);
}
File::put($directory . '/index' . ($request->getQueryString() ? md5($request->getQueryString()) : '') . '.html', $response->content());
}
return $response;
}
示例15: checkPathIsOk
private function checkPathIsOk($path, $dir = null)
{
$path = rtrim($path, '/') . ($dir ? '/' . trim($dir, '/') : '');
if (File::isDirectory($path) && File::isWritable($path)) {
return true;
} else {
try {
@File::makeDirectory($path, 0777, true);
return true;
} catch (\Exception $e) {
Log::error('Uploader: ' . $e->getMessage());
$this->results['error'] = $e->getMessage();
return false;
}
}
}