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°²×°³£¼ûÎÊÌâ
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 ......
¿ÕÓàʱ¼äдÁ˲éѯ¹¦ÄÜ£¨ÌṩÁÐ±í£¬ÏÔʾ²¿·ÖÄÚÈÝ£¬¹Ø¼ü×Ö×ÅÉ«£©
ÌṩÁËÁ½¸ö²éѯ½Ó¿Ú£º²éѯÊý¾Ý¿â½Ó¿Ú£¬Îı¾²éѯ½Ó¿Ú
²éѯÊý¾Ý¿â½Ó¿Ú£¬Õâ¸öÖ÷ÒªÊǶÔÊý¾Ý¿âÖеÄÏà¹Ø×ֶνøÐÐlike²Ù×÷£¬Ñ¡³öÏà¹Ø¼Ç¼½øÐÐÏÔʾ£¬¶ÔÓÚ´óÅúÁ¿µÄ²éѯ¿Ï¶¨»áºÍ¼õÂýϵͳÏìÓ¦µÄ£¬
Ò»°ã¿ÉÒÔÌí¼Ó±¸·ÝÒ»¸ömysql½øÐÐÕâÀàÊý¾Ý¿â½Ó¿Ú²éѯ£¬ºÍÈÕ³£µÄÆäËü²Ù×÷´ ......
»¨ÁËÈýÌìµÄʱ¼ä£¬ÖÕÓÚÀûÓÃphp+mysqlÖÆ×÷Á˸öÔÚÏ߱ʼDZ¾£¬±¾À´ÊÇÔÚÍøÉÏÕÒÁËһЩµ¥»úµÄ¼Çʱ¾£¬
ÎÒ¿¿£¬Òª²»ÊÇÐèҪע²áÂ룬Ҫ²»ÊDz»·ûºÏ×Ô¼ºµÄÐèÇó£¬ÔÙ˵µ¥»úµÄÐèÒªÔÚ±¾µØ°²×°¡£
Ö÷ÒªµÄÄ¿µÄÊÇÓÃÀ´×öÒ»¸ötodo list¹¦ÄÜ£¬Ä¿Ç°Ö§³ÖµÄ¹¦ÄܱȽϼòµ¥£ºÔö¼Ó£¬É¾³ý£¬Í³¼Æ£¬
ÉÏ´«Îļþ£¬ÀûÓÃfckeditor½øÐб༣¬°²È«·½Ãæ×öÁËЩ¼òµ¥´ ......
µÚÒ»²½ °²×°MySQL
[root@localhost usr]# groupadd mysql
[root@localhost usr]# useradd -g mysql mysql
[root@localhost usr]# cd /usr/local
[root@localhost local]# tar -zxvf mysql-5.0.51.tar.gz
[root@localhost local]# cd mysql-5.0.51
[root@localhost mysql-5.0.51# ./configure --prefix=/usr/local/my ......