国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home PHP Libraries Other libraries PHP class to generate thumbnails
PHP class to generate thumbnails
<?php
//功能:生成縮略圖
class CreatMiniature
{
//公共變量
  var $srcFile = ""; //原圖
  var $echoType; //輸出圖片類(lèi)型,link--不保存為文件;file--保存為文件
  var $im = ""; //臨時(shí)變量
  var $srcW = ""; //原圖寬
  var $srcH = ""; //原圖高
//設(shè)置變量及初始化
  function SetVar($srcFile, $echoType)
  {
    if (!file_exists($srcFile)) {
      echo '源圖片文件不存在!';
      exit();
    }
    $this->srcFile = $srcFile;
    $this->echoType = $echoType;
    $info = "";
    $data = GetImageSize($this->srcFile, $info);
    switch ($data[2]) {
      case 1:
        if (!function_exists("imagecreatefromgif")) {
          echo "你的GD庫(kù)不能使用GIF格式的圖片,請(qǐng)使用Jpeg或PNG格式!返回";
          exit();
        }

Generate thumbnail function (supports image formats: gif, jpeg, png and bmp)

* @author ruxing.li

* @param string $src Source image path

* @param int $width Thumbnail width (conformal scaling is performed when only the height is specified)

* @param int $width Thumbnail height (conformal scaling is performed when only the width is specified)

* @param string $filename Save path (directly output to the browser if not specified)

* @return bool


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

How to Efficiently Generate Thumbnails from Uploaded Images in PHP? How to Efficiently Generate Thumbnails from Uploaded Images in PHP?

07 Nov 2024

Creating a Thumbnail from an Uploaded ImageGenerating thumbnails for uploaded images ensures they don't appear distorted while preserving the...

Use the powerful imagick to easily generate combined thumbnails under PHP, imagick thumbnails_PHP tutorial Use the powerful imagick to easily generate combined thumbnails under PHP, imagick thumbnails_PHP tutorial

12 Jul 2016

Use the powerful imagick under PHP to easily generate combined thumbnails and imagick thumbnails. Use the powerful imagick to easily generate composite thumbnails under PHP, imagick thumbnails project: blogtarget: use-imagick-to-composite-images-thumbnail.mddate: 2016-02-19status: publishtags: - p

How to Generate Dynamic XML Content with PHP/Python/etc.? How to Generate Dynamic XML Content with PHP/Python/etc.?

10 Mar 2025

This article explores generating dynamic XML content using PHP and Python. It details methods using string manipulation and XML libraries (DOMDocument/ElementTree), emphasizing best practices for security (input validation, XXE prevention, XSS prote

php resizeimage partial jpg file analysis and solutions for failure to generate thumbnails, _PHP tutorial php resizeimage partial jpg file analysis and solutions for failure to generate thumbnails, _PHP tutorial

12 Jul 2016

Analysis and solutions to the reasons why php resizeimage failed to generate thumbnails for some jpg files. php resizeimage partial jpg file analysis and solutions to the reasons for failure to generate thumbnails. Today, when I encountered GD's resizeimage function to process the thumbnail of a jpg suffix file, it prompted that the image is not

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

Summary of how to generate QR code with logo in php, summary of phplogo_PHP tutorial Summary of how to generate QR code with logo in php, summary of phplogo_PHP tutorial

12 Jul 2016

Summary of the method of generating QR code with logo in php, summary of phplogo. Summary of the method of generating QR code with logo in php, summary of phplogo 1. Class libraries used 1. phpqrcode (php library) 2. qrcode.js (javascript library) 2. Use of phpqrcode Only use php class library, also

See all articles