日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

w3cschool php 调整图片尺寸,PHP_php修改上传图片尺寸的方法,本文实例讲述了php修改上传图 - phpStudy...

發布時間:2023/12/10 php 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 w3cschool php 调整图片尺寸,PHP_php修改上传图片尺寸的方法,本文实例讲述了php修改上传图 - phpStudy... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

php修改上傳圖片尺寸的方法

本文實例講述了php修改上傳圖片尺寸的方法。分享給大家供大家參考。具體實現方法如下:

// This is the temporary file created by PHP

$uploadedfile = $_FILES['uploadfile']['tmp_name'];

// Create an Image from it so we can do the resize

$src = imagecreatefromjpeg($uploadedfile);

// Capture the original size of the uploaded image

list($width,$height)=getimagesize($uploadedfile);

// For our purposes, I have resized the image to be

// 600 pixels wide, and maintain the original aspect

// ratio. This prevents the image from being "stretched"

// or "squashed". If you prefer some max width other than

// 600, simply change the $newwidth variable

$newwidth=600;

$newheight=($height/$width)*600;

$tmp=imagecreatetruecolor($newwidth,$newheight);

// this line actually does the image resizing, copying from the original

// image into the $tmp image

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

// now write the resized image to disk. I have assumed that you want the

// resized, uploaded image file to reside in the ./images subdirectory.

$filename = "images/". $_FILES['uploadfile']['name'];

imagejpeg($tmp,$filename,100);

imagedestroy($src);

imagedestroy($tmp);

// NOTE: PHP will clean up the temp file it created when the request

// has completed.

?>

希望本文所述對大家的php程序設計有所幫助。相關閱讀:

java實現檢測是否字符串中包含中文

.net泛型通用函數的特殊問題的解決方法

Win10如何使用禁用cleartype以清晰地顯示屏幕內容

ASP.NET中DropDownList和ListBox實現兩級聯動功能

JS實現獲取當前URL和來源URL的方法

Android自定義控件之自定義屬性(二)

jQuery 的全選(全非選)即取得被選中的值使用介紹

jQuery中triggerHandler()方法用法實例

win7系統無法啟動power服務提示錯誤2系統找不到指定文件的解決方法

linux系統掛載以及卸載USB接口的設備的解決辦法

C#探秘系列(一)——ToDictionary,ToLookup

jQuery實現帶動畫效果的二級下拉導航方法

window.open打開窗口被攔截的快速解決方法

修改Laravel5.3中的路由文件與路徑

總結

以上是生活随笔為你收集整理的w3cschool php 调整图片尺寸,PHP_php修改上传图片尺寸的方法,本文实例讲述了php修改上传图 - phpStudy...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。