當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。