不變形截圖的PHP代碼

function my_image_resize($src_file, $dst_file , $new_width , $new_height){$src_img=imagecreatefromjpeg($src_file);$w=imagesx($src_img);$h=imagesy($src_img);$ratio_w=1.0 * $new_width / $w;$ratio_h=1.0 * $new_height / $h;$ratio=1.0;//

php給圖片加浮水印的代碼

在使用php編程的時候, 很多時候需要對上傳的圖片加浮水印,來確定圖片著作權和出處. 但是,一般情況下加浮水印的位置是圖片的右下角,但是,不同圖片的色階不同,有時候我們圖片的浮水印和圖片本身色階相同,就會造成浮水印不明顯.下面這段代碼可 以實現自動識別圖片的色階,更加色階差來添加圖片的浮水印,這樣可以避免浮水印和圖片色階一樣的弊端. */ function add_wm($nmw_water, $src_file, $output_file, $x, $y) {

怎樣學習2015年十五個熱門的PHP開發工具

這篇文章中,課課家將為你提供一份互連網上免費的最好用的PHP開發工具列表。這份列表中包含對初學者十分有用的工具,同樣也包含專業php程式員開發特定功能所需的高端工具。  AD:  PHP是一種伺服器端的指令碼語言,通常用於web開發,但也可以用於其他普通的功能。它是最常用的語言之一,目前大約有240萬個網站是用PHP語言實現的。網路上有很多免費的php開發工具,這些工具對於PHP程式員來說是非常好用的,並且有很大的協助作用。  有很多基本的功能,也有許多進階工具,但是想找到適合你的卻不是一件容易

php上傳圖片產生縮圖

function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $quality){ $details = getimagesize("$imageDirectory/$imageName") or die('Please only upload images.'); $type = preg_replace('@^.+(? eval('$srcImg =

推薦20個近段時間很流行的重量級PHP架構

 相對於一些web開發人員來說,PHP是一款受歡迎而強的的程式設計語言。世界上大部分優秀的網站都處於php開發的。下面給大家介紹一下20個最具重量級的PHP架構。  每一個開發人員都知道,擁有一個強大的架構可以讓開發工作變得更加快捷、安全和有效。在開發項目之前選擇一款合適的架構可以為今後奠定厚實的基礎,下面這20個PHP架構你可以有選擇的使用,一定會協助到你的。  1、Laravel  Laravel是一款免費並且開源的PHP應用程式框架,它是為開發基於MVC的WEB應用而設計的,個人覺得,La

圖片縮放浮水印PHP類

/*** 圖片縮放浮水印類**/class cls_photo{protected $waterrate = 0.2; //浮水印表徵圖在圖片上的比例protected $width = 300; //縮圖預設寬度protected $height = 200; //縮圖預設高度protected $padding = 5; //浮水印圖到邊的距離protected $water_mark = "./water.png";protected $water_mark_pos =

PHP實現的計劃(定時)任務

有時候為了定時去調介面,需要程式自動運行。從網上搜到有兩種方法可以實現 1、ignore_user_abort() ignore_user_abort()函數搭配set_time_limit(0)和sleep($interval)即可實現程式自動運行更新。 //即使Client斷開(如關掉瀏覽器),PHP指令碼也可以繼續執行.ignore_user_abort();//

php限制檔案下載速度

// local file that should be send to the client$local_file = 'test-file.zip';// filename that the user gets as default$download_file = 'your-download-name.zip';// set the download rate limit (=> 20,5 kb/s)$download_rate =

截取中文字串PHP代碼

/**** 中文字串截取* @param string $string* @param int $sublen* @param int $start* @param string $code*/function substr_zh ( $string, $sublen, $start = 0, $code = 'UTF-8' ){ if ( $code == 'UTF-8' ) { $pa = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\

php 日曆類 日曆控制項

class CalendarForm { protected $year; protected $month; protected $day; protected $weekend; protected $currentdate; protected $dayofmonth; protected $day_count; protected $num; protected $week = array(); protected $retunrhtml = "";

漂亮的 PHP 驗證碼類

class Page { private $total; //總記錄 private $pagesize; //每頁顯示多少條 private $limit; //limit private $page; //當前頁碼 private $pagenum; //總頁碼

獲得用戶端使用作業系統類型的php代碼

function userOS(){ $user_OSagent = $_SERVER['HTTP_USER_AGENT']; if(strpos($user_OSagent,"NT 6.1")){ $visitor_os ="Windows 7"; } elseif(strpos($user_OSagent,"NT 5.1")) { $visitor_os ="Windows XP (SP2)"; }

PHP 產生GUID(UUID)

2.jpg (3.82 KB, 下載次數: 2)下載附件2016-1-2 15:52 上傳/** * 產生GUID(UUID) * @access public * @return string * @author knight */ function createGuid() { if (function_exists('com_create_guid')){ return com_create_guid(

給現有的圖片加文字浮水印php代碼

php類庫給現有的圖片加文字浮水印,代碼不是很完善,歡迎大家多多指教!代碼如下: /*PHP圖片加文字浮水印類庫 QQ:3697578482 傷心的歌 該類庫暫時只支援文字浮水印,位置為右下角,顏色隨機 調用方法: 1、在需要加浮水印的檔案頂部引入類庫: include_once 'imageClass.php'; 2、聲明新類: $tpl=new image_fu; 3、給圖片浮水印提供參數:

產生驗證碼 隨機幹擾php實現

session_start ();header ( 'Content-type: image/png' );//建立圖片$im = imagecreate($x=130,$y=45 );$bg = imagecolorallocate($im,rand(50,200),rand(0,155),rand(0,155)); //第一次對 imagecolorallocate() 的調用會給基於調色盤的映像填充背景色$fontColor = imageColorAllocate ( $im, 255,

全形字元轉換為半形字元PHP函數

/** * 全形字元轉換為半形字元 */function make_semiangle ( $str ){$arr = array ( '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', 'A' => 'A', 'B' => 'B', 'C' => 'C'

PHP隨機顏色產生器

function randomColor() { $str = '#'; for($i = 0 ; $i $randNum = rand(0 , 15); switch ($randNum) { case 10: $randNum = 'A'; break; case 11: $randNum = 'B'; break; case 12: $randNum = 'C';

快速安裝php7 的shell指令碼

PHP7 2015-12月正式發布,效能比5.6版本提高了不少,因此安裝php7試試,在php.ini 配置zend_extension=opcache.soopcache.enable=1opcache.enable_cli=1果然效能提高了很多。 #!/bin/bashapt-get updateapt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev

記錄頁面執行時間php代碼

class runtime{ var $StartTime = 0; var $StopTime = 0; function get_microtime() { list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } function start() {

尋找頁面中所有連結的PHP代碼

function get_links($link) { $html = file_get_contents($link); $html = str_replace("\n", "", $html); $html = preg_replace('/ $html = preg_replace('//', "\n", $html); preg_match_all('/.*?/', $html, $matches); return($matches);}複製代碼

總頁數: 5203 1 .... 1673 1674 1675 1676 1677 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.