·Ç³£¼òµ¥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
Ïà¹ØÎĵµ£º
PHP×Ö·û´®º¯Êý´óÈ«
AddSlashes: ×Ö·û´®¼ÓÈëбÏß¡£
bin2hex: ¶þ½øÎ»×ª³ÉÊ®Áù½øÎ»¡£
Chop: È¥³ýÁ¬Ðø¿Õ°×¡£
Chr: ·µ»ØÐòÊýÖµµÄ×Ö·û¡£
chunk_split: ½«×Ö·û´®·Ö³ÉС¶Î¡£
convert_cyr_string: ת»»¹Å˹À·ò×Ö·û´®³ÉÆäËü×Ö·û´®¡£
crypt: ½«×Ö·û´®Óà DES ±àÂë¼ÓÃÜ¡£
echo: Êä³ö×Ö·û´®¡£
explode: Çпª×Ö·û´®¡£
flush: Çå ......
function _processBeforeDb($str)
{
$str = str_replace ( array ('<', '>' ), array ('<' , '>' ), $str );
if (!get_magic_quotes_runtime()){
return addslashes($str);
}
else
{
return $str;
}
}
......
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 ......
__LINE__ ÎļþÖеĵ±Ç°Ðкš£
__FILE__ ÎļþµÄÍêÕû·¾¶ºÍÎļþÃû¡£Èç¹ûÓÃÔÚ±»°üº¬ÎļþÖУ¬Ôò·µ»Ø±»°üº¬µÄÎļþÃû¡£×Ô PHP 4.0.2 Æð£¬__FILE__
×ÜÊǰüº¬Ò»¸ö¾ø¶Ô·¾¶£¨Èç¹ûÊÇ·ûºÅÁ¬½Ó£¬ÔòÊǽâÎöºóµÄ¾ø¶Ô·¾¶£©£¬¶øÔÚ´Ë֮ǰµÄ°æ±¾ÓÐʱ»á°üº¬Ò»¸öÏà¶Ô·¾¶¡£
__DIR__ ÎļþËùÔÚµÄĿ¼¡£Èç¹ûÓÃÔÚ±»°üÀ¨ÎļþÖУ¬Ôò· ......
Äêǰ°ïsw666Ç¨ÒÆÍøÕ¾µ½ÎÒÃÇ·þÎñÆ÷£¬½á¹û£¬Åú·¢ÖÐÐÄÁ½ÕÅͼƬ²»ÏÔʾ£¬ÉÌÆ·Ìí¼ÓµÄËõÂÔͼ²»ÏÔʾ£¬ÓÉÓÚµÚÒ»´Î´îPHP»·¾³£¬ËùÒÔÕÕ×ÅÍøÉϵĽ̳ÌÒ»²½²½¸ã£¬´îºÃºóÄÜ·ÃÎÊ£¬µ«¾ÍÊÇͼƬÓÐÎÊÌâ¡£ÔõôŪ¶¼¸ã²»¶¨
ǰ¼¸ÌìÖÜÉлԴó¸ç˵ÊÇgd¿âµÄÎÊÌ⣬ÎÒ¾ÍÅäÖÃÁËÏÂphp.iniÎļþ£¬¸Ä³ÉÖ§³ÖÁËgd¿â£¬ºóÃæÒª²é¿´ÊÇ·ñÓÐgd¿â£¬±àдphp.phpÎļþ
< ......