本文整理汇总了PHP中FileUtils::buildPath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::buildPath方法的具体用法?PHP FileUtils::buildPath怎么用?PHP FileUtils::buildPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::buildPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveBookletImage
private static function saveBookletImage($bookletCode, $imageName, $base64Image)
{
$bookletImagesRoot = DBPreferencesType::getPreferenceS(Constants::BOOKLET_IMAGE_PATH);
$bookletImageDirectory = FileUtils::buildPath($bookletImagesRoot, $bookletCode);
FileUtils::createDir($bookletImageDirectory);
$imageEditor = ImageEditor::newImageBase64($base64Image);
$bookletImagePath = FileUtils::buildPath($bookletImagesRoot, $bookletCode, $imageName);
$imageEditor->saveImage($bookletImagePath);
return FileUtils::buildPath($bookletCode, $imageName);
}
示例2: newImageBase64
public static function newImageBase64($base64)
{
$tmpDir = FileUtils::getTmpDir();
$imageExtension = Utils::getImageExtensionFromBase64($base64);
$imageName = Utils::getRandomString() . '.' . $imageExtension;
$path = FileUtils::buildPath($tmpDir, $imageName);
$base64PrefixLess = Utils::extractBase64($base64);
FileUtils::createDir($tmpDir);
chmod($tmpDir, 0777);
$file = file_put_contents($path, base64_decode($base64PrefixLess));
chmod($path, 0777);
if ($file == true) {
$instance = new ImageEditor($path);
}
return $instance;
}
示例3: getImages
public static function getImages($id)
{
$pref = new DBPreferencesType();
$catalogDir = $pref->getPreference(Constants::CATALOG_PATH)[DB::TABLE_PREFERENCES__VALUE];
$goodsType = new DBGoodsType();
$good = $goodsType->get($id);
$goodCode = $good[DB::TABLE_GOODS__KEY_ITEM];
$images = [];
if (!is_null($goodCode)) {
$images = FileUtils::getFilesByPrefixByDescription(FileUtils::buildPath($catalogDir, $goodCode), Constants::SMALL_IMAGE, "jpg");
//$filesMedium = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH.DIRECTORY_SEPARATOR.$goodCode.DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, "jpg");
}
return $images;
}
示例4: updatePrices
public static function updatePrices($data)
{
$result = [];
if (count($data) > 0) {
$dbPreference = new DBPreferencesType();
$priceDirectory = $dbPreference->getPreference(Constants::PRICE_DIRECTORY)[DB::TABLE_PREFERENCES__VALUE];
for ($orderIndex = 0; $orderIndex < count(self::$operationsOrder); $orderIndex++) {
$currentAction = self::$operationsOrder[$orderIndex];
foreach ($data as $key => $value) {
if ($value['action'] == $currentAction) {
$operationRes = false;
switch ($currentAction) {
case self::PRICE_DEL:
$operationRes = unlink(FileUtils::buildPath($priceDirectory, $value['name']));
break;
case self::PRICE_RENAME:
$operationRes = rename(FileUtils::buildPath($priceDirectory, $value['name']), FileUtils::buildPath($priceDirectory, $value['new_name']));
break;
case self::PRICE_ADD:
$operationRes = FileUtils::createFileBase64($value['file'], FileUtils::buildPath($priceDirectory, $value['name']));
break;
}
$result[$key] = $operationRes;
}
}
}
}
return $result;
}