本文整理汇总了PHP中FileUtil::fileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::fileSize方法的具体用法?PHP FileUtil::fileSize怎么用?PHP FileUtil::fileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::fileSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
public static function export($idstr)
{
$idArr = is_array($idstr) ? $idstr : explode(",", $idstr);
if (1 < count($idArr)) {
$zip = new Zip();
$exportFileName = Ibos::lang("Form export file pack", "workflow.default", array("{date}" => date("Y-m-d")));
$zipFileName = FileUtil::getTempPath() . "/" . TIMESTAMP . ".zip";
foreach ($idArr as $id) {
$form = self::handleExportSingleForm($id);
$zip->addFile($form["content"], sprintf("%s.html", ConvertUtil::iIconv($form["title"], CHARSET, "gbk")));
}
$fp = fopen($zipFileName, "w");
if (@fwrite($fp, $zip->file()) !== false) {
header("Cache-control: private");
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Content-Length: " . sprintf("%u", FileUtil::fileSize($zipFileName)));
header("Content-Disposition: attachment; filename=" . $exportFileName . ".zip");
readfile($zipFileName);
exit;
}
} else {
$id = implode(",", $idArr);
$form = self::handleExportSingleForm($id);
ob_end_clean();
header("Cache-control: private");
header("Content-type: text/plain");
header("Accept-Ranges: bytes");
header("Accept-Length: " . strlen($form["content"]));
header("Content-Disposition: attachment; filename=" . $form["title"] . ".html");
echo $form["content"];
}
}
示例2: getImageInfo
public static function getImageInfo($img)
{
$imageInfo = FileUtil::imageSize($img);
if ($imageInfo !== false) {
$imageType = strtolower(substr(image_type_to_extension($imageInfo[2]), 1));
$imageSize = FileUtil::fileSize($img);
$info = array("width" => $imageInfo[0], "height" => $imageInfo[1], "type" => $imageType, "size" => $imageSize, "mime" => $imageInfo["mime"]);
return $info;
} else {
return false;
}
}
示例3: getEmailSize
public static function getEmailSize($content, $attachmentId = "")
{
$tmpfile = "data/emailsize.temp";
FileUtil::createFile($tmpfile, $content);
$emailContentSize = FileUtil::fileSize($tmpfile);
FileUtil::deleteFile($tmpfile);
$attFileSize = 0;
if (!empty($attachmentId)) {
$attach = AttachUtil::getAttachData($attachmentId, false);
foreach ($attach as $value) {
$attFileSize += intval($value["filesize"]);
}
}
return intval($emailContentSize + $attFileSize);
}
示例4: actionIndex
public function actionIndex()
{
$operation = EnvUtil::getRequest("op");
switch ($operation) {
case "thumbpreview":
case "waterpreview":
$temp = Ibos::engine()->IO()->file()->getTempPath() . "/watermark_temp.jpg";
if (LOCAL) {
if (is_file($temp)) {
@unlink($temp);
}
}
$quality = EnvUtil::getRequest("quality");
$source = PATH_ROOT . "/static/image/watermark_preview.jpg";
if ($operation == "waterpreview") {
$trans = EnvUtil::getRequest("trans");
$type = EnvUtil::getRequest("type");
$val = EnvUtil::getRequest("val");
$pos = EnvUtil::getRequest("pos");
if ($type == "image") {
$sInfo = ImageUtil::getImageInfo($source);
$wInfo = ImageUtil::getImageInfo($val);
if ($sInfo["width"] < $wInfo["width"] || $sInfo["height"] < $wInfo["height"]) {
Ibos::import("ext.ThinkImage.ThinkImage", true);
$imgObj = new ThinkImage(THINKIMAGE_GD);
$imgObj->open($val)->thumb(260, 77, 1)->save($val);
}
ImageUtil::water($source, $val, $temp, $pos, $trans, $quality);
} else {
$hexColor = EnvUtil::getRequest("textcolor");
$size = EnvUtil::getRequest("size");
$fontPath = EnvUtil::getRequest("fontpath");
$rgb = ConvertUtil::hexColorToRGB($hexColor);
ImageUtil::waterMarkString($val, $size, $source, $temp, $pos, $quality, $rgb, self::TTF_FONT_PATH . $fontPath);
}
$image = $temp;
}
if (!LOCAL) {
if (Ibos::engine()->IO()->file()->createFile($temp, file_get_contents($image))) {
$image = FileUtil::fileName($temp);
}
}
$data = array("image" => $image, "sourceSize" => ConvertUtil::sizeCount(FileUtil::fileSize($source)), "thumbSize" => ConvertUtil::sizeCount(FileUtil::fileSize($image)), "ratio" => sprintf("%2.1f", FileUtil::fileSize($image) / FileUtil::fileSize($source) * 100) . "%");
$this->render("imagePreview", $data);
exit;
break;
case "upload":
return $this->imgUpload("watermark", true);
break;
}
$formSubmit = EnvUtil::submitCheck("uploadSubmit");
$uploadKeys = "attachdir,attachurl,thumbquality,attachsize,filetype";
$waterMarkkeys = "watermarkminwidth,watermarkminheight,watermarktype,watermarkposition,watermarktrans,watermarkquality,watermarkimg,watermarkstatus,watermarktext,watermarkfontpath";
if ($formSubmit) {
$keys = $uploadKeys . "," . $waterMarkkeys;
$keyField = explode(",", $keys);
foreach ($_POST as $key => $value) {
if (in_array($key, $keyField)) {
Setting::model()->updateSettingValueByKey($key, $value);
} elseif ($key == "watermarkstatus") {
Setting::model()->updateSettingValueByKey("watermarkstatus", 0);
}
}
CacheUtil::update(array("setting"));
$this->success(Ibos::lang("Save succeed", "message"));
} else {
$upload = Setting::model()->fetchSettingValueByKeys($uploadKeys);
$waterMark = Setting::model()->fetchSettingValueByKeys($waterMarkkeys);
$fontPath = DashboardUtil::getFontPathlist(self::TTF_FONT_PATH);
$data = array("upload" => $upload, "waterMark" => $waterMark, "fontPath" => $fontPath);
$this->render("index", $data);
}
}