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


PHP SimpleImage::output方法代码示例

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


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

示例1: Thumbnail

 static function Thumbnail($image_file, $thumb_file, $width = 48, $height = 48)
 {
     $ctype = FSS_Helper::datei_mime("png");
     // thumb file exists
     if (file_exists($thumb_file) && filesize($thumb_file) > 0) {
         header("Content-Type: " . $ctype);
         header('Cache-control: max-age=' . 60 * 60 * 24 * 365);
         header('Expires: ' . gmdate(DATE_RFC1123, time() + 60 * 60 * 24 * 365));
         @readfile($thumb_file);
         exit;
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'third' . DS . 'simpleimage.php';
     $im = new SimpleImage();
     $im->load($image_file);
     if (!$im->image) {
         // return a blank thumbnail of some sort!
         $im->load(JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'assets' . DS . 'images' . DS . 'blank_16.png');
     }
     $im->resize($width, $height);
     $im->output();
     $im_data = ob_get_clean();
     if (strlen($im_data) > 0) {
         // if so use JFile to write the thumbnail image
         JFile::write($thumb_file, $im_data);
     } else {
         // it failed for some reason, try doing a direct write of the thumbnail
         $im->save($thumb_file);
     }
     header('Cache-control: max-age=' . 60 * 60 * 24 * 365);
     header('Expires: ' . gmdate(DATE_RFC1123, time() + 60 * 60 * 24 * 365));
     header("Content-Type: " . $ctype);
     if (file_exists($thumb_file && filesize($thumb_file) > 0)) {
         @readfile($thumb_file);
     } else {
         $im->output();
     }
     exit;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:38,代码来源:files.php

示例2: get_file

 public function get_file($modelID = '', $id = '', $filetype = '', $filename = '')
 {
     if ($id != '') {
         $fileinfo = $this->file_model->get_fileinfo($modelID, $id, $filetype);
         if ($fileinfo['Status']) {
             if (file_exists(absolute_path() . APPPATH . 'files/' . $fileinfo['LocalFileName'])) {
                 switch (strtolower($filetype)) {
                     case "thumbnails":
                         $size = explode('_', $filename);
                         if (!is_numeric($size[0]) or $size[0] <= 0) {
                             show_404();
                         }
                         if (!is_numeric($size[1]) or $size[0] <= 0) {
                             show_404();
                         }
                         $img = new SimpleImage();
                         $img->load(absolute_path() . APPPATH . 'files/' . $fileinfo['LocalFileName'])->best_fit($size[0], $size[1]);
                         $img->output('jpg');
                         break;
                     default:
                         $mm_type = mime_content_type($fileinfo['FileName']);
                         header('Content-Description: File Transfer');
                         header('Content-Type: ' . $mm_type);
                         header('Content-Disposition: ' . $fileinfo['DispositionType'] . '; filename=' . basename($fileinfo['FileName']));
                         header('Content-Transfer-Encoding: binary');
                         header('Expires: 0');
                         header('Cache-Control: must-revalidate');
                         header('Pragma: public');
                         header('Content-Length: ' . filesize(APPPATH . 'files/' . $fileinfo['LocalFileName']));
                         ob_clean();
                         flush();
                         readfile(APPPATH . 'files/' . $fileinfo['LocalFileName']);
                 }
             }
         } else {
             show_404();
         }
     } else {
         show_404();
     }
 }
开发者ID:mdbhk,项目名称:retailersurvey.themdbfamily.com,代码行数:41,代码来源:file.php

示例3: SimpleImage

<?php

if (isset($_POST['submit'])) {
    ?>
  <?php 
    include 'classSimpleImage.php';
    $image = new SimpleImage();
    $image->load($_FILES['uploaded_image']['tmp_name']);
    $image->resizeToWidth(150);
    $image->output();
} else {
    ?>
  ?>
  <form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="uploaded_image" />
    <input type="submit" name="submit" value="Upload" />
  </form>
<?php 
}
开发者ID:EkkiKakinaki,项目名称:sanchiz-net-sandbox,代码行数:19,代码来源:form.php

示例4: thumbnail

 function thumbnail($img)
 {
     ob_end_clean();
     header('Content-Type: image/png');
     kernel::loadLib("simpleimage");
     $image = new SimpleImage();
     $image->load($img);
     $image->resizeToWidth(480);
     $image->output();
     exit;
 }
开发者ID:roxio,项目名称:TenTego2,代码行数:11,代码来源:app_admin.php

示例5: SimpleImage

    $equipment = EquipmentDao::getEquipmentByID($_GET['equipId']);
    if (!$equipment) {
        $image = new SimpleImage();
        $image->load("./images/notfound.png");
        header('Content-Type: image/png');
        echo $image->output();
        Database::Close();
        exit;
    } else {
        if (file_exists("./images/" . $equipment->picture)) {
            $image_info = getimagesize("./images/" . $equipment->picture);
            $image_type = $image_info[2];
            if ($image_type == IMAGETYPE_JPEG) {
                header('Content-Type: image/jpeg');
            } elseif ($image_type == IMAGETYPE_GIF) {
                header('Content-Type: image/gif');
            } elseif ($image_type == IMAGETYPE_PNG) {
                header('Content-Type: image/png');
            }
            echo file_get_contents("./images/" . $equipment->picture);
        } else {
            $image = new SimpleImage();
            $image->load("./images/notfound.png");
            header('Content-Type: image/png');
            echo $image->output();
            Database::Close();
            exit;
        }
    }
}
Database::Close();
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:31,代码来源:getImage.php

示例6: intval

    $id_personagem = intval($_POST['id_personagem']);
    $personagem = Personagem::pegar($id_personagem);
    if (array_key_exists('imagem_content', $_POST)) {
        $targ_w = $targ_h = 72;
        $jpeg_quality = 90;
        $img_r = imagecreatefromstring(base64_decode($_POST['imagem_content']));
        $dst_r = ImageCreateTrueColor($targ_w, $targ_h);
        imagecopyresampled($dst_r, $img_r, 0, 0, $_POST['x'], $_POST['y'], $targ_w, $targ_h, $_POST['w'], $_POST['h']);
        $personagem->setImagem($dst_r);
    } elseif (array_key_exists('imagem_principal_url', $_POST) && $_POST['imagem_principal_url'] != '') {
        $imagem_content = file_get_contents($_POST['imagem_principal_url']);
        $regraImage = new SimpleImage();
        $regraImage->image = imagecreatefromstring($imagem_content);
        $regraImage->resizeToWidth(400);
        ob_start();
        $regraImage->output(IMAGETYPE_JPEG);
        $imagem_content = ob_get_contents();
        ob_end_clean();
        $imagem_content = base64_encode($imagem_content);
    } else {
        header("Location: personagem.php?personagem=" . $personagem->getId());
        exit;
    }
}
require 'header.php';
?>
<form method="POST" onsubmit="return checkCoords();">
<input type="hidden" name="acao" value="gravar" />
<?php 
if (!is_null($imagem_content)) {
    ?>
开发者ID:landim32,项目名称:gurps-simulator,代码行数:31,代码来源:arte_1.php

示例7: exibeThumbnail

 public function exibeThumbnail($size = 20)
 {
     $query = "\n            SELECT imagem\n            FROM jogador\n            WHERE id_jogador = '" . do_escape($this->id_jogador) . "'\n        ";
     $base64 = get_value($query, 'imagem');
     $image = new SimpleImage();
     $image->image = imagecreatefromstring(base64_decode($base64));
     $image->image_type = IMAGETYPE_JPEG;
     $image->resize($size, $size);
     header('content-type: image/jpeg');
     $image->output();
     exit;
 }
开发者ID:landim32,项目名称:gurps-simulator,代码行数:12,代码来源:JogadorClass.php

示例8: exibeThumbnail

 public function exibeThumbnail($size = 20)
 {
     $id_personagem = $this->id_personagem;
     if (!is_null($this->id_original)) {
         $id_personagem = $this->id_original;
     }
     $query = "\n            SELECT foto\n            FROM personagem\n            WHERE id_personagem = '" . do_escape($id_personagem) . "'\n        ";
     $base64 = get_value($query, 'foto');
     $image = new SimpleImage();
     $image->image = imagecreatefromstring(base64_decode($base64));
     $image->image_type = IMAGETYPE_JPEG;
     $image->resize($size, $size);
     header('content-type: image/jpeg');
     $image->output();
     exit;
 }
开发者ID:landim32,项目名称:gurps-simulator,代码行数:16,代码来源:PersonagemClass.php

示例9: healthToState

                        } else {
                            $mid = "ST";
                            $end = healthToState($health) . rand(0, 2);
                        }
                    }
                }
            }
        }
    }
}
$filename = "faces/" . $stub . $mid . $end . ".png";
$image = new SimpleImage();
$image->load($filename);
if ($scale >= 5) {
    $image->scale($scale);
} else {
    if ($width != "" && $height != "") {
        $image->resize($width, $height);
    } else {
        if ($width != "") {
            $image->resizeToWidth($width);
        } else {
            if ($height != "") {
                $image->resizeToHeight($height);
            }
        }
    }
}
header('Content-Type: image/png');
$image->output(IMAGETYPE_PNG);
开发者ID:lampholder,项目名称:doomface,代码行数:30,代码来源:doomface.php

示例10: getImageData

function getImageData($name, $maxHeight = 300, $maxWidth = 300)
{
    if (!defined('MAX_FILE_SIZE')) {
        define('MAX_FILE_SIZE', 1024 * 500);
    }
    $imageid = 0;
    // make sure it's a genuine file upload
    if (is_uploaded_file($_FILES[$name]['tmp_name'])) {
        // replace any spaces in original filename with underscores
        $filename = str_replace(' ', '_', $_FILES[$name]['name']);
        // get the MIME type
        $mimetype = $_FILES[$name]['type'];
        if ($mimetype == 'image/pjpeg') {
            $mimetype = 'image/jpeg';
        }
        // create an array of permitted MIME types
        $permitted = array('image/gif', 'image/jpeg', 'image/png', 'image/x-png');
        // upload if file is OK
        if (in_array($mimetype, $permitted)) {
            switch ($_FILES[$name]['error']) {
                case 0:
                    // get the file contents
                    // Temporary file name stored on the server
                    //		      $tmpName  = $_FILES[$name]['tmp_name'];
                    //
                    //		      // Read the file
                    //		      $fp = fopen($tmpName, 'r');
                    //		      $image = fread($fp, filesize($tmpName));
                    //		      fclose($fp);
                    // get the width and height
                    $size = getimagesize($_FILES[$name]['tmp_name']);
                    $width = $size[0];
                    $height = $size[1];
                    if ($width > $maxWidth || $height > $maxHeight) {
                        $image = new SimpleImage();
                        $image->load($_FILES[$name]['tmp_name']);
                        if ($width - $maxWidth > $height - $maxHeight) {
                            $image->resizeToWidth($maxWidth);
                        } else {
                            $image->resizeToHeight($maxHeight);
                        }
                        ob_start();
                        $image->output();
                        $binimage = ob_get_clean();
                    } else {
                        $binimage = file_get_contents($_FILES[$name]['tmp_name']);
                    }
                    $image = mysql_real_escape_string($binimage);
                    $filename = mysql_escape_string($_FILES[$name]['name']);
                    $description = mysql_escape_string($_POST['description']);
                    $result = mysql_query("INSERT INTO {$_SESSION['DB_PREFIX']}images " . "(description, name, mimetype, image, imgwidth, imgheight, metacreateddate, metacreateduserid, metamodifieddate, metamodifieduserid) " . "VALUES " . "('{$description}', '{$filename}', '{$mimetype}', '{$image}', {$width}, {$height}, NOW(), " . getLoggedOnMemberID() . ", NOW(), " . getLoggedOnMemberID() . ")");
                    if (!$result) {
                        throw new Exception("Cannot persist image data ['{$filename}']:" . mysql_error());
                    }
                    $imageid = mysql_insert_id();
                    break;
                case 3:
                case 6:
                case 7:
                case 8:
                    throw new Exception("Error uploading {$filename}. Please try again.");
                    break;
                case 4:
                    throw new Exception("You didn't select a file to be uploaded.");
            }
        } else {
            throw new Exception("{$filename} is not an image.");
        }
    }
    return $imageid;
}
开发者ID:prodigyworks,项目名称:Service-Call,代码行数:71,代码来源:sqlfunctions.php


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