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


PHP Ibos::engine方法代码示例

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


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

示例1: init

 public function init()
 {
     $mainConfig = Ibos::engine()->getMainConfig();
     $config = $mainConfig["cache"];
     $this->_config = $config;
     $this->setExtension();
     $this->_prefix = empty($config["prefix"]) ? substr(md5($_SERVER["HTTP_HOST"]), 0, 6) . "_" : $config["prefix"];
     foreach (array("eaccelerator", "apc", "xcache", "wincache", "filecache") as $cache) {
         if (!is_object($this->_instance) && $this->_extension[$cache] && $this->config[strtolower($cache)]) {
             $className = ucfirst($cache);
             $this->_instance = new $className();
             $this->_instance->init(null);
             break;
         }
     }
     if (is_object($this->_instance)) {
         $this->enable = true;
         $this->type = get_class($this->_instance);
         if (strtolower($this->type) == "filecache") {
             $this->_prefix = "";
         }
     } else {
         throw new EnvException(Ibos::lang("Cache init error", "error"));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:25,代码来源:ICCache.php

示例2: save

 public function save($imgname, $type = NULL, $interlace = true)
 {
     if (empty($this->img)) {
         throw new Exception("没有可以被保存的图像资源");
     }
     if (is_null($type)) {
         $type = $this->info["type"];
     } else {
         $type = strtolower($type);
     }
     if ("jpeg" == $type || "jpg" == $type) {
         $type = "jpeg";
         imageinterlace($this->img, $interlace);
     }
     if ("gif" == $type && !empty($this->gif)) {
         $this->gif->save($imgname);
     } else {
         $fun = "image{$type}";
         if (!LOCAL) {
             $temp = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($imgname), $this->info["type"]);
             $fun($this->img, $temp);
             $content = file_get_contents($temp);
             Ibos::engine()->IO()->file()->writeFile($imgname, $content);
         } else {
             $fun($this->img, $imgname);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:ImageGd.class.php

示例3: makeThumb

 public static function makeThumb($attach, $width, $height)
 {
     $attachUrl = FileUtil::getAttachUrl();
     $file = sprintf("%s/%s", $attachUrl, $attach["attachment"]);
     $fileext = StringUtil::getFileExt($file);
     $thumbName = self::getThumbName($attach, $width, $height);
     if (LOCAL) {
         $res = ImageUtil::thumb2($file, $thumbName, "", $width, $height);
     } else {
         $tempFile = FileUtil::getTempPath() . "tmp." . $fileext;
         $orgImgname = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($file), $fileext);
         ImageUtil::thumb2($orgImgname, $tempFile, "", $width, $height);
         FileUtil::createFile($thumbName, file_get_contents($tempFile));
     }
     return $thumbName;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:WbCommonUtil.php

示例4: configure

 public function configure($config)
 {
     defined("ENGINE") || define("ENGINE", "LOCAL");
     $this->setImport($config["import"]);
     unset($config["import"]);
     $engineClass = ucfirst(strtolower(ENGINE)) . "Engine";
     $engine = new $engineClass($config);
     Ibos::setEngine($engine);
     parent::configure(Ibos::engine()->getEngineConfig());
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:ICApplication.php

示例5: sendWebMail

 public static function sendWebMail($toUser, $body, $web)
 {
     $user = User::model()->fetchByUid($web["uid"]);
     $password = StringUtil::authCode($web["password"], "DECODE", $user["salt"]);
     $mailer = Yii::createComponent("application.modules.email.extensions.mailer.EMailer");
     $mailer->IsSMTP();
     $mailer->SMTPDebug = 0;
     $mailer->Host = $web["smtpserver"];
     $mailer->Port = $web["smtpport"];
     $mailer->CharSet = "UTF-8";
     if ($web["smtpssl"]) {
         $mailer->SMTPSecure = "ssl";
     }
     $mailer->SMTPAuth = true;
     $mailer->Username = $web["username"];
     $mailer->Password = $password;
     $mailer->setFrom($web["address"], $web["nickname"]);
     foreach (explode(";", $toUser) as $address) {
         $mailer->addAddress($address);
     }
     $mailer->Subject = $body["subject"];
     $mailer->msgHTML($body["content"]);
     $mailer->AltBody = "This is a plain-text message body";
     if (!empty($body["attachmentid"])) {
         $attachs = AttachUtil::getAttachData($body["attachmentid"]);
         $attachUrl = FileUtil::getAttachUrl();
         foreach ($attachs as $attachment) {
             $url = $attachUrl . "/" . $attachment["attachment"];
             if (LOCAL) {
                 $mailer->addAttachment($url, $attachment["filename"]);
             } else {
                 $temp = Ibos::engine()->IO()->file()->fetchTemp($url);
                 $mailer->addAttachment($temp, $attachment["filename"]);
             }
         }
     }
     $status = $mailer->send();
     if ($status) {
         return true;
     } else {
         return $mailer->ErrorInfo;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:43,代码来源:WebMailUtil.php

示例6: copyToDir

 public static function copyToDir($file, $copyToPath)
 {
     if (FileUtil::fileExists($file)) {
         $name = basename($file);
         if (LOCAL) {
             $state = @copy($file, $copyToPath . $name);
         } else {
             $state = Ibos::engine()->IO()->file()->moveFile($file, $copyToPath . $name);
         }
         return $state;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:12,代码来源:FileUtil.php

示例7: addPicture

 private function addPicture($attach, $articleId)
 {
     $sort = 0;
     foreach ($attach as $value) {
         $picture = array("articleid" => $articleId, "aid" => $value["aid"], "sort" => $sort, "addtime" => TIMESTAMP, "postip" => StringUtil::getSubIp(), "filename" => $value["filename"], "title" => "", "type" => $value["filetype"], "size" => $value["filesize"], "filepath" => $value["attachment"]);
         if (Yii::app()->setting->get("setting/articlethumbenable")) {
             list($thumbWidth, $thumbHeight) = explode(",", Yii::app()->setting->get("setting/articlethumbwh"));
             $imageInfo = ImageUtil::getImageInfo(FileUtil::fileName($picture["filepath"]));
             if ($imageInfo["width"] < $thumbWidth && $imageInfo["height"] < $thumbHeight) {
                 $picture["thumb"] = 0;
             } else {
                 $sourceFileName = explode("/", $picture["filepath"]);
                 $sourceFileName[count($sourceFileName) - 1] = "thumb_" . $sourceFileName[count($sourceFileName) - 1];
                 $thumbName = implode("/", $sourceFileName);
                 if (LOCAL) {
                     ImageUtil::thumb($picture["filepath"], $thumbName, $thumbWidth, $thumbHeight);
                 } else {
                     $tempFile = FileUtil::getTempPath() . "tmp." . $picture["type"];
                     $orgImgname = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($picture["filepath"]), $picture["type"]);
                     ImageUtil::thumb($orgImgname, $tempFile, $thumbWidth, $thumbHeight);
                     FileUtil::createFile($thumbName, file_get_contents($tempFile));
                 }
                 $picture["thumb"] = 1;
             }
         }
         ArticlePicture::model()->add($picture);
         $sort++;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:29,代码来源:DefaultController.php

示例8: 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);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:73,代码来源:UploadController.php


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