ÓÃphpµ÷ÕûͼƬ¿í¸ß
<?php
/**
* ¸Ä±äͼƬµÄ¿í¸ß
*
* @author flynetcn (2009-12-16)
*
* @param string $img_src ÔͼƬµÄ´æ·ÅµØÖ·»òurl
* @param string $new_img_path ÐÂͼƬµÄ´æ·ÅµØÖ·
* @param int $new_width ÐÂͼƬµÄ¿í¶È
* @param int $new_height ÐÂͼƬµÄ¸ß¶È
* @return bool ³É¹¦true, ʧ°Üfalse
*/
function resize_image($img_src, $new_img_path, $new_width, $new_height)
{
$img_info = @getimagesize($img_src);
if (!$img_info || $new_width < 1 || $new_height < 1 || empty($new_img_path)) {
return false;
}
if (strpos($img_info['mime'], 'jpeg') !== false) {
$pic_obj = imagecreatefromjpeg($img_src);
} else if (strpos($img_info['mime'], 'gif') !== false) {
$pic_obj = imagecreatefromgif($img_src);
} else if (strpos($img_info['mime'], 'png') !== false) {
$pic_obj = imagecreatefrompng($img_src);
} else {
return false;
}
$pic_width = imagesx($pic_obj);
$pic_height = imagesy($pic_obj);
if (function_exists("imagecopyresampled")) {
$new_img = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($new_img, $pic_obj, 0, 0, 0, 0, $new_width, $new_height, $pic_width, $pic_height);
} else {
$new_img = imagecreate($new_width, $new_height);
imagecopyresized($new_img, $pic_obj, 0, 0, 0, 0, $new_width, $new_height, $pic_width, $pic_height);
}
if (preg_match('~.([^.]+)$~', $new_img_path, $match)) {
$new_type = strtolower($match[1]);
switch ($new_type) {
case 'jpg':
imagejpeg($new_img, $new_img_path);
break;
case 'gif':
imagegif($new_img, $new_img_path);
break;
case 'png':
imagepng($new_img, $new_img_path);
break;
default:
imagejpeg($new_img, $new_img_path);
}
} else {
imagejpeg($new_img, $new_img_path);
Ïà¹ØÎĵµ£º
¼¯³É»·¾³:WAMP...(W-windows,ÀïÃæÓÐApache·þÎñÆ÷¡¢Mysql¡¢PhpºÍMysql¿ÉÊÓ»¯¹¤¾ßSQLite)
Ps:°²×°¹ý³Ì»áÓÐÌáʾ£¬ÊÇ·ñ×ÔÆô¶¯£¬Ä¬ÈÏ¿ª·¢Ä¿Â¼¡¢Ä¬ÈÏä¯ÀÀÆ÷£¬°²×°Íê³Éºó»áÔÚÓÒϽÇÓиöС±íÅÌ£¬ÒòΪĬÈÏ°²×°Íê³ÉºóÊÇÓ¢ÎÄ°æµÄ£¬ÔÚС±íÅÌÉϵãÓÒ¼ü-->language-->Ñ¡ÔñÖÐÎľÍÐÐ)
¿ª·¢¹¤¾ß:easyeclipse
php...»¹²»´íµÄÒ»¸ö¿ª ......
php½Ì³Ì:·ÃÎÊPHPÀàÖгÉÔ±±äÁ¿»ò·½·¨
ÔÚ·ÃÎÊPHPÀàÖеijÉÔ±±äÁ¿»ò·½·¨Ê±£¬Èç¹û±»ÒýÓõıäÁ¿»òÕß·½·¨±»ÉùÃ÷³Éconst»òÕßstatic,ÄÇô¾Í±ØÐëʹÓòÙ×÷·û::,
·´Ö®Èç¹û±»ÒýÓõıäÁ¿»òÕß·½·¨Ã»Óб»ÉùÃ÷³Éconst»òÕßstatic,ÄÇô¾Í±ØÐëʹÓòÙ×÷·û->¡£
ÁíÍ⣬Èç¹û´ÓÀàµÄÄÚ²¿·ÃÎÊconst»òÕßstatic±äÁ¿»òÕß·½·¨,ÄÇô¾Í±ØÐëʹÓÃ×ÔÒýÓõ ......
ÓÐͬѧÐèҪʹÓÃSSL+FTPµÄ·½Ê½¼ÓÃÜ´«ÊäÎļþ¡£Ï£ÍûÎÒ¸ø·â×°Ò»¸ö¶«Î÷£¬ÐèÇó¾ÍÊÇ¿ÉÒÔÉÏ´«Îļþ£¨PUT£©ºÍÔ¶¶Ë¸ÄÃû£¨RENAME£©¾ÍÐС£
ÎÒ¿ªÊ¼ÒÔΪSSL+FTP = SFTP£¬ºóÀ´·¢ÏÖÕâ¸öÏë·¨ºÃÏñÊÇ´íÎóµÄ¡£SFTPÊÇÅÜÔÚSSHÐÒéÉÏÃæµÄFTP£¬¶øFTPs¾ÍÏñhttpsÒ»ÑùÊÇÅÜÔÚSSLÐÒéÉÏÃæµÄFTP¡£
ʾÀý³ÌÐòʹÓÃÁËftp_ssl_connectº¯Êý¡£Ô´´úÂëÈçÏ£º
#! / ......
ÏÖÔÚÖ÷Á÷µÄÍøÕ¾¿ª·¢ÓïÑÔÎÞÍâºõasp¡¢php¡¢asp.net¡¢jspµÈ¡£
ÍøÒ³´Ó¿ªÊ¼¼òµ¥µÄhmtlµ½¸´ÔӵķþÎñÓïÑÔ£¬×ß¹ýÁË10¶à¸öÄêÍ·£¬¸÷ÖÖ¼¼Êõ²ã³ö²»Çµ¥¸öµÄÖ÷Á÷¼¼ÊõÒ²ÔÚ²»¶Ï·Ðµİ汾£¬ÏÖÔÚ·ÖÎöϸ÷ÖÖÓïÑÔµÄÇø±ð¡¢ÓÅÊÆ¡¢ÁÓÊÆ¡¢¿ª·¢×¢ÒâÊÂÏ
HTML:µ±È»ÕâÊÇÍøÒ³×î»ù±¾µÄÓïÑÔ,ÿһ¸ö·þÎñÆ÷ÓïÑÔ¶¼ÐèÒªËüµÄÖ§³Ö,Ҫѧϰ,Õâ¸ö¿Ï¶¨ÊÇ¿ª ......
»ù´¡Ìâ:
1.±íµ¥ÖÐ getÓëpostÌá½»·½·¨µÄÇø±ð?
´ð:getÊÇ·¢ËÍÇëÇóHTTPÐÒéͨ¹ýurl²ÎÊý´«µÝ½øÐнÓÊÕ,¶øpostÊÇʵÌåÊý¾Ý,¿ÉÒÔͨ¹ý±íµ¥Ìá½»´óÁ¿ÐÅÏ¢.
2.sessionÓëcookieµÄÇø±ð?
´ð:session:´¢´æÓû§·ÃÎʵÄÈ«¾ÖΨһ±äÁ¿,´æ´¢ÔÚ·þÎñÆ÷ÉϵÄphpÖ¸¶¨µÄĿ¼Öеģ¨session_dir£©µÄλÖýøÐеĴæ·Å
cookie:ÓÃÀ´´æ´¢Á¬Ðø ......