Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

·Ç³£¼òµ¥PHPËõÂÔͼÉú³É³ÌÐòÔ´´úÂë


Ò»¸ö·Ç³£¼òµ¥µÄPHPÉú³ÉËõÂÔͼµÄ´úÂë³ÌÐò£¬²ÎÊý¼°´úÂ붼ËãµÃÉϾ«¼ò£¬ÓÐÐËȤµÄÅóÓÑ¿ÉÒÔÊÔÏÂËüµÄ¹¦ÄÜ£¬Óв»Ì«ÍêÉƵĵط½»¹ÇëÖ¸Õý¡£ ·ÇÔ­´´£¬À´×ÔÍøÂç
<?$FILENAME="image_name";
// Éú³ÉͼƬµÄ¿í¶È
$RESIZEWIDTH=400;
// Éú³ÉͼƬµÄ¸ß¶È
$RESIZEHEIGHT=400;
function ResizeImage($im,$maxwidth,$maxheight,$name){
$width = imagesx($im);
$height = imagesy($im);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)){
if($maxwidth && $width > $maxwidth){
$widthratio = $maxwidth/$width;
$RESIZEWIDTH=true;
}
if($maxheight && $height > $maxheight){
$heightratio = $maxheight/$height;
$RESIZEHEIGHT=true;
}
if($RESIZEWIDTH && $RESIZEHEIGHT){
if($widthratio < $heightratio){
$ratio = $widthratio;
}else{
$ratio = $heightratio;
}
}elseif($RESIZEWIDTH){
$ratio = $widthratio;
}elseif($RESIZEHEIGHT){
$ratio = $heightratio;
}
$newwidth = $width * $ratio;
$newheight = $height * $ratio;
if(function_exists("imagecopyresampled")){
www.phperz.com
$newim = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}else{
$newim = imagecreate($newwidth, $newheight);
imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}
ImageJpeg ($newim,$name . ".jpg");
ImageDestroy ($newim);
}else{
ImageJpeg ($im,$name . ".jpg");
}
}
if($_FILES['image']['size']){
if($_FILES['image']['type'] == "image/pjpeg"){
$im = imagecreatefromjpeg($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/x-png"){
$im = imagecreatefrompng($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/gif"){
$im = imagecreatefromgif($_FILES['image']['tmp_name']);
}
if($im){
if(file_exists("$FILENAME.jpg")){
unlink("$FILENAME.jpg");
}
ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME); www~phperz~com
ImageDestroy ($im);
}
}
?>
<img src="<? echo($FILENAME.".jpg?rel


Ïà¹ØÎĵµ£º

linuxÏÂapache+php°²×°³£¼ûÎÊÌâ


linuxÏÂapache+php°²×°³£¼ûÎÊÌâ
configure: error: Unable to find libgd.(a|so)
Èç¹ûʹÓõÄÊÇubuntu»òdebian¾ÍºÜ¼òµ¥ÁË£¬Ö±½Ósudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd ¾Í»ù±¾Éϸ㶨£¬µ«ÊÇÓÃÔ´´úÂë°²×°»¹ÊǺÜÂé·³¡«
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11 ......

¿ªÊ¼Ñ§Ï°PHP¿ª·¢ÒÔ¼°ÍøÂ繤³Ì

1.¶¨Î»£¬Ã÷È··½Ïò¡£
2.¶¨Î»ºó¾ÍÈ¥³¢ÊÔ¡£²»ÒªÔÙ̸Äܲ»ÄÜ×ö¡£
ÒÔÉÏÊǺÃÓѸøÎҵĽ¨Ò飬ºÜÖпϡ£
µÚÒ»µã£¬ÎÒÐèҪȷ¶¨×Ô¼º½ñºó·¢Õ¹µÄ·½Ïò£¬²»ÄÜÔÙÏñÏÖÔÚÕâÑùʲô¶¼È¥Ñ§£¬½á¹ûʲô¶¼Ò»ÎÞËù³É¡£
µÚ¶þµã£¬Öƶ¨¼Æ»®ºó¾ÍÓ¦¸ÃÂíÉÏ×ÅÊÖÈ¥Ö´ÐУ¬Óöµ½´ìÕÛʱ²»Òª¼±×Å˵£¬ÎÒ°¾Ò¹Á˶à¾Ã¶à¾Ã£¬»¹ÊÇûѧ»á°¡£¬¶øÊǾ²ÐÄ·ÖÎö£¬È»ºó¶ÔÖ¢ÏÂÒ©£¬ ......

php headerÏê½â


header
(PHP 3, PHP 4, PHP 5)
header -- ·¢ËÍÒ»¸öԭʼ HTTP ±êÍ·
˵Ã÷
void header ( string string [, bool replace [, int http_response_code]] )
header() º¯ÊýÓÃÀ´·¢ËÍÒ»¸öԭʼ HTTP ±êÍ·¡£ÓÐ¹Ø HTTP ±êÍ·µÄ¸ü¶àÄÚÈݼû HTTP/1.1 ¹æ·¶¡£
¿ÉÑ¡²ÎÊý replace Ö¸Ã÷ÊÇÌæ»»µôÇ°Ò»ÌõÀàËƵıêÍ·»¹ÊÇÔö¼ÓÒ»ÌõÏàͬÀàÐ͵ ......

PHPÖÐħÊõ³£Á¿

__LINE__ ÎļþÖеĵ±Ç°Ðкš£
 
__FILE__ ÎļþµÄÍêÕû·¾¶ºÍÎļþÃû¡£Èç¹ûÓÃÔÚ±»°üº¬ÎļþÖУ¬Ôò·µ»Ø±»°üº¬µÄÎļþÃû¡£×Ô PHP 4.0.2 Æð£¬__FILE__
×ÜÊÇ°üº¬Ò»¸ö¾ø¶Ô·¾¶£¨Èç¹ûÊÇ·ûºÅÁ¬½Ó£¬ÔòÊǽâÎöºóµÄ¾ø¶Ô·¾¶£©£¬¶øÔÚ´Ë֮ǰµÄ°æ±¾ÓÐʱ»á°üº¬Ò»¸öÏà¶Ô·¾¶¡£

__DIR__ ÎļþËùÔÚµÄĿ¼¡£Èç¹ûÓÃÔÚ±»°üÀ¨ÎļþÖУ¬Ôò· ......

PHPÖÐstripslashesºÍaddslashesµÄʹÓÃ

ÏòmysqlдÈëÊý¾Ýʱ£¬È磺mysql_query("update tableName set `title`='goaler's blog'");
¡¡¡¡Õâ¸öʱºò£¬PHP½«»á±¨´í£¬ASPÖд¦ÀíʱҲһÑù¡£
¡¡¡¡ÒòΪÊý¾Ý¿â¶Ôµ¥ÒýºÅ¹ýÃô¡£
¡¡¡¡ASPÖÐÐèÒª½øÐÐreplace("'","''",str)£»
¡¡¡¡¶øPHPÖÐÔò¿ÉÒÔÖ±½ÓʹÓÃaddslashes¡£
¡¡¡¡ASPÎÊÌâÕâÀïÔݲ»¿¼ÂÇ£¬±¾ÎÄҪ˵µÄÊÇPHPÏà¹ØµÄstrip ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ