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


PHP Image::render方法代码示例

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


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

示例1: renderInternal

 /**
  * Render the given element
  *
  * @return array
  */
 public function renderInternal()
 {
     $image = new Image();
     if (!($this->contentObject->data['imageorient'] & 24)) {
         $lines = $image->render($this->contentObject, $this->configuration);
         $lines[] = '';
     }
     $lines[] = $this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext'])));
     if ($this->contentObject->data['imageorient'] & 24) {
         $lines[] = '';
         $lines = array_merge($lines, $image->render($this->contentObject, $this->configuration));
     }
     return $lines;
 }
开发者ID:ercuement,项目名称:ink,代码行数:19,代码来源:TextPicture.php

示例2: render

 /**
  * Renders image
  *
  * @param int $quality
  * @throws Imagify_Exception
  * @return string
  */
 public function render($quality = 80)
 {
     if (!isset($this->_image)) {
         throw new Imagify_Exception('Image is not yet created to render it');
     }
     echo $this->_image->render(null, $quality);
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:14,代码来源:Imagify.php

示例3: makeThumbnail

 public function makeThumbnail($id, $field, $w, $h, $crop = false, $enlarge = false)
 {
     $path = $this->getImagePath($id, $field);
     //		\helpers\Debug::prePrintR($path);
     if (!empty($path)) {
         $tn = ($crop ? 'cr' : '') . ($enlarge ? 'en' : '');
         $cache = str_replace($this->tableMeta->get('table'), $this->tableMeta->get('table') . '/tmp/' . $tn . $w, $path);
         if (file_exists($cache)) {
             $ext = pathinfo($path, PATHINFO_EXTENSION);
             $img = new \Image($cache);
             echo $img->render($ext);
             return true;
         } elseif (file_exists($path)) {
             // Создаём и сохраняем миниатюру
             $img = new \Image($path);
             $img->resize($w, $h, $crop, $enlarge);
             $dir = $this->makeDirStructure($id, $tn . $w);
             if ($dir) {
                 $ext = pathinfo($path, PATHINFO_EXTENSION);
                 $f3 = \Base::instance();
                 $res = $f3->write($dir . $tn . $field . '.' . $ext, $img->dump());
                 echo $img->render($ext);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:forKoda,代码行数:28,代码来源:ImageFieldsManager.php

示例4: captchaF3

 public static function captchaF3()
 {
     $img = new \Image();
     $img->captcha('template/captchaFonts/Browning.ttf', 16, 5, 'SESSION.captcha');
     $_SESSION['captcha'] = password_hash($_SESSION['captcha'], PASSWORD_DEFAULT);
     ob_start();
     $img->render();
     $image_data = ob_get_contents();
     ob_end_clean();
     echo base64_encode($image_data);
 }
开发者ID:eFiction,项目名称:v5_1-vaporware,代码行数:11,代码来源:auth.php

示例5: photo_handler

 public function photo_handler($f3)
 {
     /*echo $f3->get('PARAMS.certi_type') . "<br>";
     		
     		echo $f3->get('PARAMS.category') . "<br>";
     		
     		echo $f3->get('PARAMS.filename') . "<br>";*/
     $temp = $f3->get('certi_folder');
     //echo $temp[$f3->get('PARAMS.certi_type')];
     $docpath = DOCROOT . "/";
     $docpath .= $f3->get("doc_folder_name") . "/";
     $docpath .= $temp[$f3->get('PARAMS.certi_type')] . "/";
     $docpath .= $f3->get('PARAMS.category') . "/";
     $file = $f3->get('PARAMS.filename');
     $file = setEncryptDecrption($file, false);
     $img = new Image($file, FALSE, $docpath);
     $img->render();
     exit;
 }
开发者ID:btkarthick,项目名称:kar-personal-profile,代码行数:19,代码来源:class.filehandler.php

示例6: thumbnail

 function thumbnail($file, $width, $height, $crop = true, $enlarge = true)
 {
     $domain = $this->f3->get("domain");
     //test_array($file);
     $thumb = explode(".", $file);
     $thumbExt = $thumb[count($thumb) - 1];
     $thumb = str_replace("." . $thumbExt, "_thumb." . $thumbExt, $file);
     $cfg = $this->f3->get("cfg");
     $folder = $cfg['media'];
     $path = $folder;
     $path = $this->f3->fixslashes($path);
     $path = str_replace("//", "/", $path);
     //test_array($file);
     $folder = "";
     //	test_array($file);
     header('Pragma: public');
     header('Cache-Control: max-age=86400');
     header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 86400));
     $thumb = new Image($file, false, $path);
     $thumb->resize($width, $height, $crop, $enlarge);
     $thumb->render('jpeg');
     $showthumb = true;
 }
开发者ID:WilliamStam,项目名称:Directory,代码行数:23,代码来源:general.php

示例7: die

            if ($crop) {
                $image->scaleSpace($width, $height, $_REQUEST['bg']);
            } else {
                $image->scale($width, $height, $_REQUEST['bg']);
            }
            $image->renderOutputHeader($actual_name);
            $image->render($cacheFile);
            print file_get_contents($cacheFile);
        } else {
            if (!($image = new Image($cacheFile, $quality))) {
                die("<h1>Symphony Fatal Error</h1><p>Error opening cached image<hr /><em>" . $_SERVER['SERVER_SIGNATURE'] . "</em>");
            }
            $image->renderOutputHeader($actual_name);
            $image->render();
        }
    } else {
        if (!($image = new Image($file, $quality))) {
            die("<h1>Symphony Fatal Error</h1><p>Error creating Image in memory<hr /><em>" . $_SERVER['SERVER_SIGNATURE'] . "</em>");
        }
        if ($crop) {
            $image->scaleSpace($width, $height, $_REQUEST['bg']);
        } else {
            $image->scale($width, $height, $_REQUEST['bg']);
        }
        $image->renderOutputHeader($actual_name);
        $image->render();
    }
    $image->close();
    unset($image);
    exit;
}
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:31,代码来源:image.php

示例8: file_attach

function file_attach($id)
{
    $con = connection();
    $date = date("Y-m-d H:i:s");
    $max_file_size = 4194304;
    if (!$_FILES['userfile']['name'][0] == '') {
        if (isset($_FILES['userfile']['tmp_name'])) {
            for ($i = 0; $i < count($_FILES['userfile']['tmp_name']); $i++) {
                //$allowed_filetypes = array('.pdf','.txt','.word','.doc','.xls','.docx','.ppt','.xlsx');
                $allowed_filetypes = array('.png', '.jpeg', '.jpg');
                $final_path = "../attachment/";
                $final_path_thumb = "../attachment/thumb";
                $filename = $_FILES['userfile']['name'][$i];
                $ext = substr($filename, strpos($filename, '.'), strlen($filename) - 1);
                if (!in_array($ext, $allowed_filetypes)) {
                    die('The file that you are trying to upload is not allowed.');
                }
                if (!is_uploaded_file($_FILES['userfile']['tmp_name'][$i])) {
                    $message = 'No file uploaded';
                }
                if ($_FILES['userfile']['size'][$i] > $max_file_size) {
                    $message = "File size exceeds {$max_file_size} limit";
                }
                $new_filename = md5(date("Y-m-d H:i:s")) . rand() . $ext;
                $p = $final_path . $new_filename;
                //echo $_FILES['userfile']['tmp_name'][$i];
                //echo "<br>";
                if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $p)) {
                    require_once 'image.class.php';
                    $image = new Image($p);
                    $image->destination = $final_path_thumb . '/' . $new_filename;
                    //echo $final_path_thumb.'/'.$new_filename;
                    $image->constraint = 'w';
                    $image->size = 220;
                    $image->quality = 100;
                    $image->render();
                    if (store_file($id, $new_filename)) {
                        return true;
                    } else {
                        return false;
                    }
                    //
                } else {
                    return false;
                }
            }
        }
    }
}
开发者ID:OpenLabsHackerspace,项目名称:OSCAL2016-REST-API,代码行数:49,代码来源:lib.php

示例9: _do_watermark

 protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity)
 {
     if (!Image_GD::$_bundled) {
         throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', array(':function' => 'imagelayereffect'));
     }
     // Loads image if not yet loaded
     $this->_load_image();
     // Create the watermark image resource
     $overlay = imagecreatefromstring($watermark->render());
     // Get the width and height of the watermark
     $width = imagesx($overlay);
     $height = imagesy($overlay);
     if ($opacity < 100) {
         // Convert an opacity range of 0-100 to 127-0
         $opacity = round(abs($opacity * 127 / 100 - 127));
         // Allocate transparent white
         $color = imagecolorallocatealpha($overlay, 255, 255, 255, $opacity);
         // The transparent image will overlay the watermark
         imagelayereffect($overlay, IMG_EFFECT_OVERLAY);
         // Fill the background with transparent white
         imagefilledrectangle($overlay, 0, 0, $width, $height, $color);
     }
     // Alpha blending must be enabled on the background!
     imagealphablending($this->_image, TRUE);
     if (imagecopy($this->_image, $overlay, $offset_x, $offset_y, 0, 0, $width, $height)) {
         // Destroy the overlay image
         imagedestroy($overlay);
     }
 }
开发者ID:homm,项目名称:image,代码行数:29,代码来源:gd.php

示例10: _do_watermark

 protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity)
 {
     // Create the watermark image resource
     $overlay = imagecreatefromstring($watermark->render());
     // Get the width and height of the watermark
     $width = imagesx($overlay);
     $height = imagesy($overlay);
     if ($opacity < 100) {
         // Convert an opacity range of 0-100 to 127-0
         $opacity = round(abs($opacity * 127 / 100 - 127));
         // Allocate transparent white
         $color = imagecolorallocatealpha($overlay, 255, 255, 255, $opacity);
         // The transparent image will overlay the watermark
         imagelayereffect($overlay, IMG_EFFECT_OVERLAY);
         // Fill the background with transparent white
         imagefilledrectangle($overlay, 0, 0, $width, $height, $color);
     }
     // Alpha blending must be enabled on the background!
     imagealphablending($this->_image, TRUE);
     if (imagecopy($this->_image, $overlay, $offset_x, $offset_y, 0, 0, $width, $height)) {
         // Destroy the overlay image
         imagedestroy($overlay);
     }
 }
开发者ID:joelpittet,项目名称:image,代码行数:24,代码来源:gd.php

示例11: actionImage

 public function actionImage()
 {
     $file_name = Yii::app()->request->getParam('path');
     $tmp_path = Yii::app()->runtimePath;
     $new_filename = $tmp_path . '/' . $file_name;
     Yii::import('application.extensions.image.Image');
     $image_base = new Image($new_filename);
     $image_base->render();
 }
开发者ID:vangogogo,项目名称:justsns,代码行数:9,代码来源:WeiboController.php

示例12: _do_watermark

 protected function _do_watermark(Image $image, $offset_x, $offset_y, $opacity)
 {
     $filein = isset($this->filetmp) ? $this->filetmp : $this->file;
     // Create temporary file to store the watermark image
     $watermark = tempnam(Upload::$default_directory, '');
     $fp = fopen($watermark, 'wb');
     if (!fwrite($fp, $image->render())) {
         return FALSE;
     }
     // Merge watermark with image
     $fileout = tempnam(Upload::$default_directory, '');
     $command = Image_ImageMagick::get_command('composite');
     $command .= ' -quality 100 -dissolve ' . escapeshellarg($opacity) . '% -geometry +' . escapeshellarg($offset_x) . '+' . escapeshellarg($offset_y);
     $command .= ' ' . escapeshellarg($watermark) . ' ' . escapeshellarg($filein);
     $command .= ' ' . escapeshellarg('PNG:' . $fileout);
     //save as PNG to keep transparency
     exec($command, $response, $status);
     if ($status) {
         return FALSE;
     }
     // Delete temp files and close handlers
     fclose($fp);
     unlink($watermark);
     // Delete old tmp file if exist
     if (isset($this->filetmp) && file_exists($this->filetmp)) {
         unlink($this->filetmp);
     }
     // Update image data
     $this->filetmp = $fileout;
     return TRUE;
 }
开发者ID:2bj,项目名称:kohana-imagemagick-driver,代码行数:31,代码来源:imagemagick.php

示例13: render

 function render($type = 'jpg', $dst_file = '')
 {
     return parent::render($type, $dst_file);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:4,代码来源:ImageResizer.php

示例14: avatar

 /**
  * @param \Base $f3
  * @param array $params
  * @throws \Exception
  */
 public function avatar($f3, $params)
 {
     // Ensure proper content-type for JPEG images
     if ($params["format"] == "jpg") {
         $params["format"] = "jpeg";
     }
     $user = new \Model\User();
     $user->load($params["id"]);
     if ($user->avatar_filename && is_file("uploads/avatars/" . $user->avatar_filename)) {
         // Use local file
         $img = new \Image($user->avatar_filename, null, "uploads/avatars/");
         $img->resize($params["size"], $params["size"]);
         // Render and output image
         header("Content-type: image/" . $params["format"]);
         $img->render($params["format"]);
     } else {
         // Send user to Gravatar
         $f3->reroute($f3->get("SCHEME") . ":" . \Helper\View::instance()->gravatar($user->email, $params["size"]), true);
     }
 }
开发者ID:phemmyster,项目名称:phproject,代码行数:25,代码来源:files.php

示例15: _do_watermark

 /**
  * Execute a watermarking.
  *
  * @param   Image    $image     watermarking Image
  * @param   integer  $offset_x  offset from the left
  * @param   integer  $offset_y  offset from the top
  * @param   integer  $opacity   opacity of watermark
  * @return  void
  */
 protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity)
 {
     if (empty(GD::$_available_functions[GD::IMAGELAYEREFFECT])) {
         die('This method requires "imagelayereffect", which is only available in the bundled version of GD');
     }
     // Loads image if not yet loaded
     $this->_load_image();
     // Create the watermark image resource
     $overlay = imagecreatefromstring($watermark->render());
     imagesavealpha($overlay, TRUE);
     // Get the width and height of the watermark
     $width = imagesx($overlay);
     $height = imagesy($overlay);
     if ($opacity < 100) {
         // Convert an opacity range of 0-100 to 127-0
         $opacity = round(abs($opacity * 127 / 100 - 127));
         // Allocate transparent gray
         $color = imagecolorallocatealpha($overlay, 127, 127, 127, $opacity);
         // The transparent image will overlay the watermark
         imagelayereffect($overlay, IMG_EFFECT_OVERLAY);
         // Fill the background with the transparent color
         imagefilledrectangle($overlay, 0, 0, $width, $height, $color);
     }
     // Alpha blending must be enabled on the background!
     imagealphablending($this->_image, TRUE);
     if (imagecopy($this->_image, $overlay, $offset_x, $offset_y, 0, 0, $width, $height)) {
         // Destroy the overlay image
         imagedestroy($overlay);
     }
 }
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:39,代码来源:GD.php


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