本文整理汇总了PHP中Files::makeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::makeFile方法的具体用法?PHP Files::makeFile怎么用?PHP Files::makeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::makeFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delFile
/**
* Delete the relative file, and any thumbnails.
* @param string $relative the relative file.
* @return boolean true if deleted, false otherwise.
*/
function _delFile($relative)
{
$fullpath = Files::makeFile($this->getImagesDir(), $relative);
//check that the file is an image
if ($this->config['validate_images'] == true) {
if (!is_array($this->getImageInfo($fullpath))) {
return false;
}
//hmmm not an Image!!???
}
$thumbnail = $this->getThumbName($fullpath);
if (Files::delFile($fullpath)) {
return Files::delFile($thumbnail);
} else {
return false;
}
}
示例2: ImageManager
* relative to the base_dir given in config.inc.php
* @author $Author$
* @version $Id$
* @package ImageManager
*/
require_once 'config.inc.php';
require_once 'Classes/ImageManager.php';
require_once 'Classes/Thumbnail.php';
//check for img parameter in the url
if (!isset($_GET['img'])) {
exit;
}
$manager = new ImageManager($IMConfig);
//get the image and the full path to the image
$image = rawurldecode($_GET['img']);
$fullpath = Files::makeFile($manager->getBaseDir(), $image);
//not a file, so exit
if (!is_file($fullpath)) {
exit;
}
$imgInfo = @getImageSize($fullpath);
//Not an image, send default thumbnail
if (!is_array($imgInfo)) {
//show the default image, otherwise we quit!
$default = $manager->getDefaultThumb();
if ($default) {
header('Location: ' . $default);
exit;
}
}
//if the image is less than the thumbnail dimensions
示例3: js_fail
$image = $_GET['img'];
$fullpath = Files::makeFile($manager->getImagesDir(), $image);
//not a file, so exit
if (!is_file($fullpath)) {
js_fail("File {$fullpath} does not exist.");
}
$imgInfo = @getImageSize($fullpath);
//Not an image, bail out.
if (!is_array($imgInfo)) {
js_fail("File {$fullpath} is not an image.");
}
if (!isset($_GET['to'])) {
$resized = $manager->getResizedName($fullpath, $_GET['width'], $_GET['height']);
$_GET['to'] = $manager->getResizedName($image, $_GET['width'], $_GET['height'], FALSE);
} else {
$resized = Files::makeFile($manager->getImagesDir(), $_GET['to']);
}
// Check to see if it already exists
if (is_file($resized)) {
// And is newer
if (filemtime($resized) >= filemtime($fullpath)) {
js_success($_GET['to']);
}
}
// resize (thumbnailer will do this for us just fine)
$thumbnailer = new Thumbnail($_GET['width'], $_GET['height']);
$thumbnailer->proportional = FALSE;
$thumbnailer->createThumbnail($fullpath, $resized);
// did it work?
if (is_file($resized)) {
js_success($_GET['to']);
示例4: getFullPath
/**
* Get the fullpath to a relative file.
* @param string $relative the relative file.
* @return string the full path, .ie. the base_dir + relative.
*/
function getFullPath($relative)
{
return Files::makeFile($this->getBaseDir(), $relative);
}
示例5: processPaste
function processPaste()
{
switch ($_GET['paste']) {
case 'copyFile':
$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
$file = $_GET['file'];
$dest = Files::makeFile($this->getImagesDir(), $_GET['dir']);
return Files::copyFile($src, $dest, $file);
break;
case 'copyDir':
$basePath = $this->getImagesDir();
$src = $_GET['srcdir'] . $_GET['file'];
$dest = $_GET['dir'] . $_GET['file'];
return Files::copyDir($basePath, $src, $dest);
break;
case 'moveFile':
$src = Files::makePath($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
$dest = Files::makePath($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
return Files::rename($src, $dest);
break;
case 'moveDir':
$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
$dest = Files::makeFile($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
return Files::rename($src, $dest);
break;
}
}
示例6: ExtendedFileManager
$insertMode = $_REQUEST['mode'];
}
if (!isset($insertMode)) {
$insertMode = "image";
}
require_once 'config.inc.php';
require_once 'Classes/ExtendedFileManager.php';
require_once '../ImageManager/Classes/Thumbnail.php';
//check for img parameter in the url
if (!isset($_GET['img'])) {
exit;
}
$manager = new ExtendedFileManager($IMConfig, $insertMode);
//get the image and the full path to the image
$image = rawurldecode($_GET['img']);
$fullpath = Files::makeFile($manager->getImagesDir(), $image);
//not a file, so exit
if (!is_file($fullpath)) {
exit;
}
$imgInfo = @getImageSize($fullpath);
//Not an image, send default thumbnail
if (!is_array($imgInfo)) {
//show the default image, otherwise we quit!
$default = $manager->getDefaultThumb();
if ($default) {
header('Location: ' . $default);
exit;
}
}
//if the image is less than the thumbnail dimensions
示例7: _delFile
/**
* Delete the relative file, and any thumbnails.
* @param string $relative the relative file.
* @return boolean true if deleted, false otherwise.
*/
function _delFile($relative)
{
$fullpath = Files::makeFile($this->getBaseDir(), $relative);
//check that the file is an image
if ($this->config['validate_images']) {
if (!is_array($this->getImageInfo($fullpath))) {
return false;
}
//hmmm not an Image!!???
}
$thumbnail = $this->getThumbName($fullpath);
if (Files::delFile($fullpath)) {
//deleting from the DB
global $_course;
if (isset($_course) && !empty($_course) && isset($_course['code'])) {
$document_path = substr($fullpath, strpos($fullpath, '/document/') + 9, strlen($fullpath));
// /shared_folder/4/name
DocumentManager::delete_document($_course, $document_path, $fullpath);
}
return Files::delFile($thumbnail);
} else {
return false;
}
}
示例8: processRenames
/**
* Renames files if certain GET variables are set
* @return bool
*/
function processRenames()
{
if (!empty($_GET['rename']) && !empty($_GET['renameTo'])) {
// new file name (without path and extension)
$newName = Files::escape(rawurldecode($_GET['renameTo']));
$newName = str_replace('.', '', $newName);
// path to file (from base images directory)
$oldName = rawurldecode($_GET['rename']);
// strip parent dir ("..") to avoid escaping from base directiory
$oldName = preg_replace('#\\.\\.#', '', $oldName);
// path to old file
$oldPath = Files::makeFile($this->getImagesDir(), $oldName);
$ret = Files::renameFile($oldPath, $newName);
if ($ret === true) {
// delete old thumbnail
Files::delFile($this->getThumbname($oldPath));
}
return $ret;
}
return null;
}