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


PHP Folder::createFolder方法代码示例

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


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

示例1: File

// Create file object
$file = new File();
// Create folder object
$folder = new Folder();
// Get values
$folderId = getValue("folderId");
$name = getValue("folderName");
// Check if user has permission to create a folder
if (!$login->isAdmin()) {
    $login->printLoginForm();
    exit;
}
// Create folder
if (!empty($_GET["mode"])) {
    // Create folder
    $errors = $folder->createFolder($name, $folderId);
    // Redirect to parent folder
    if (!$errors->hasErrors()) {
        redirect(scriptUrl . "/" . folderFilesAdmin . "/index.php?folderId=" . $folder->id);
    }
}
// Generate navigation
$site->addNavigationLink(scriptUrl . "/" . folderAdmin, $lAdminIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderFilesAdmin, $lFileIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderFilesAdmin . "/" . fileFilesCreateFolder, $lFileCreateFolder["Header"]);
// Print common header
$site->printHeader();
// Print description
echo "<p>" . $lFileCreateFolder["HeaderText"] . "</p>";
// Print errors if any
if ($errors->hasErrors()) {
开发者ID:gkathir15,项目名称:catmis,代码行数:31,代码来源:createFolder.php

示例2: array

  uploadPicture.php uploads the picture onto the machine and keeps the image in the upload folder
-->

<?php 
include 'createFolder.php';
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
$extension = strtolower($extension);
$uploadholder = dirname(__FILE__) . "/upload";
$uploadFolder = new Folder();
if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/x-png" || $_FILES["file"]["type"] == "image/png") && $_FILES["file"]["size"] < 500000 && in_array($extension, $allowedExts)) {
    if ($_FILES["file"]["error"] > 0) {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
    } else {
        $uploadFolder->createFolder($uploadholder);
        if (file_exists("upload/" . $_FILES["file"]["name"])) {
            echo '<p><hr>';
            echo $_FILES["file"]["name"] . " already exists. ";
            echo '<p><hr>';
            $moviepic = "NULL";
        } else {
            move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
            $moviepic = "upload/" . $_FILES["file"]["name"];
        }
        // end of else
    }
    // end of else
} else {
    if (empty($_FILES["file"]["type"])) {
        echo " ";
开发者ID:jenz270,项目名称:MovieScreening,代码行数:31,代码来源:uploadPicture.php

示例3: getimagesize

        $thumb_length = 1;
        if (file_exists($ordner . '/thumbnails/' . $getPhotoNr . '.jpg')) {
            // Ermittlung der Original Bildgroesse
            $bildgroesse = getimagesize($ordner . '/thumbnails/' . $getPhotoNr . '.jpg');
            $thumb_length = $bildgroesse[1];
            if ($bildgroesse[0] > $bildgroesse[1]) {
                $thumb_length = $bildgroesse[0];
            }
        }
        // Nachsehen ob Bild als Thumbnail in entsprechender Groesse hinterlegt ist
        // Wenn nicht anlegen
        if (!file_exists($ordner . '/thumbnails/' . $getPhotoNr . '.jpg') || $thumb_length != $gPreferences['photo_thumbs_scale']) {
            // Nachsehen ob Thumnailordner existiert und wenn nicht SafeMode ggf. anlegen
            if (!file_exists($ordner . '/thumbnails')) {
                $folder = new Folder($ordner);
                $folder->createFolder('thumbnails', true);
            }
            // nun das Thumbnail anlegen
            $image = new Image($picpath);
            $image->scaleLargerSide($gPreferences['photo_thumbs_scale']);
            $image->copyToFile(null, $ordner . '/thumbnails/' . $getPhotoNr . '.jpg');
        } else {
            header('content-type: image/jpg');
            echo readfile($ordner . '/thumbnails/' . $getPhotoNr . '.jpg');
        }
    } else {
        // kein Bild uebergeben, dann NoPix anzeigen
        $image = new Image(THEME_SERVER_PATH . '/images/nopix.jpg');
        $image->scaleLargerSide($gPreferences['photo_thumbs_scale']);
    }
} else {
开发者ID:martinbrylski,项目名称:admidio,代码行数:31,代码来源:photo_show.php

示例4: handle_file_upload

 /**
  * Override the default method to handle the specific things of the photo module and
  * update the database after file was succesful uploaded.
  * This method has the same parameters as the default.
  * @param  $uploaded_file
  * @param  $name
  * @param  $size
  * @param  $type
  * @param  $error
  * @param  $index
  * @param  $content_range
  * @return stdClass
  */
 protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
 {
     global $photoAlbum, $gPreferences, $gL10n;
     $file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
     if (!isset($file->error)) {
         try {
             $fileLocation = SERVER_PATH . '/adm_my_files/photos/upload/' . $file->name;
             $albumFolder = SERVER_PATH . '/adm_my_files/photos/' . $photoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $photoAlbum->getValue('pho_id');
             // create folder if not exists
             if (!file_exists($albumFolder)) {
                 $error = $photoAlbum->createFolder();
                 if ($error['text'] !== '') {
                     $file->error = $gL10n->get($error['text'], $error['path']);
                     return $file;
                 }
             }
             $newFotoFileNumber = $photoAlbum->getValue('pho_quantity') + 1;
             // read image size
             $imageProperties = getimagesize($fileLocation);
             $imageDimensions = $imageProperties[0] * $imageProperties[1];
             if ($imageDimensions > admFuncProcessableImageSize()) {
                 $errorText = $gL10n->get('PHO_RESOLUTION_MORE_THAN') . ' ' . round(admFuncProcessableImageSize() / 1000000, 2) . ' ' . $gL10n->get('MEGA_PIXEL');
                 throw new AdmException($errorText);
             }
             // check mime type and set file extension
             if ($imageProperties['mime'] === 'image/jpeg') {
                 $fileExtension = 'jpg';
             } elseif ($imageProperties['mime'] === 'image/png') {
                 $fileExtension = 'png';
             } else {
                 throw new AdmException('PHO_PHOTO_FORMAT_INVALID');
             }
             // create image object and scale image to defined size of preferences
             $image = new Image($fileLocation);
             $image->setImageType('jpeg');
             $image->scaleLargerSide($gPreferences['photo_save_scale']);
             $image->copyToFile(null, $albumFolder . '/' . $newFotoFileNumber . '.jpg');
             $image->delete();
             // if enabled then save original image
             if ($gPreferences['photo_keep_original'] == 1) {
                 if (!file_exists($albumFolder . '/originals')) {
                     $folder = new Folder($albumFolder);
                     $folder->createFolder('originals', true);
                 }
                 rename($fileLocation, $albumFolder . '/originals/' . $newFotoFileNumber . '.' . $fileExtension);
             }
             // save thumbnail
             if (!file_exists($albumFolder . '/thumbnails')) {
                 $folder = new Folder($albumFolder);
                 $folder->createFolder('thumbnails', true);
             }
             $image = new Image($fileLocation);
             $image->scaleLargerSide($gPreferences['photo_thumbs_scale']);
             $image->copyToFile(null, $albumFolder . '/thumbnails/' . $newFotoFileNumber . '.jpg');
             $image->delete();
             // delete image from upload folder
             if (file_exists($fileLocation)) {
                 unlink($fileLocation);
             }
             // if image was successfully saved in filesystem then update image count of album
             if (file_exists($albumFolder . '/' . $newFotoFileNumber . '.jpg')) {
                 $photoAlbum->setValue('pho_quantity', $photoAlbum->getValue('pho_quantity') + 1);
                 $photoAlbum->save();
             } else {
                 throw new AdmException('PHO_PHOTO_PROCESSING_ERROR');
             }
         } catch (AdmException $e) {
             $file->error = $e->getText();
             unlink($this->options['upload_dir'] . $file->name);
             return $file;
         }
     }
     return $file;
 }
开发者ID:sistlind,项目名称:admidio,代码行数:87,代码来源:uploadhandlerphoto.php


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