¼æÈÝÐÔ×îÇ¿µÄPHPÉú³ÉËõÂÔͼµÄ´úÂë
дͨÓÃÐÔ³ÌÐò¿¼ÂǼæÈÝÐÔÊǺÜÍ·Í´µÄÊÂÇ飬¹ØÓÚÓÃPHPÉú³ÉËõÂÔͼµÄ´úÂëºÜ¶à£¬²»¹ýÄÜÍêÈ«¼æÈÝgd1.6ºÍgd2.x£¬²¢Äܱ£Ö¤ËõͼÇåÎúÐԵĴúÂ뼸ºõûÓУ¬ÎÒ°ÑÎÒÒÔÇ°µÄ´úÂë¸ÄÁËһϣ¬¾ÍÄÜʵÏÖÁË¡£
function ImageResize($srcFile,$toW,$toH,$toFile="") { if($toFile==""){ $toFile = $srcFile; } $info = ""; $data = GetImageSize($srcFile,$info); switch ($data[2]) { case 1: if(!function_exists("imagecreatefromgif")){ echo "ÄãµÄGD¿â²»ÄÜʹÓÃGIF¸ñʽµÄͼƬ£¬ÇëʹÓÃJpeg»òPNG¸ñʽ£¡<a href='[removed]go(-1);'>·µ»Ø</a>"; exit(); } $im = ImageCreateFromGIF($srcFile); break; case 2: if(!function_exists("imagecreatefromjpeg")){ echo "ÄãµÄGD¿â²»ÄÜʹÓÃjpeg¸ñʽµÄͼƬ£¬ÇëʹÓÃÆäËü¸ñʽµÄͼƬ£¡<a href='[removed]go(-1);'>·µ»Ø</a>"; exit(); } $im = ImageCreateFromJpeg($srcFile); break; case 3: $im = ImageCreateFromPNG($srcFile); break; } $srcW=ImageSX($im); $srcH=ImageSY($im); $toWH=$toW/$toH; $srcWH=$srcW/$srcH; if($toWH<=$srcWH){ $ftoW=$toW; $ftoH=$ftoW*($srcH/$srcW); } else{ $ftoH=$toH; $ftoW=$ftoH*($srcW/$srcH); } if($srcW>$toW||$srcH>$toH) { if(function_exists("imagecreatetruecolor")){ @$ni = ImageCreateTrueColor($ftoW,$ftoH); if($ni) ImageCopyResampled($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); else{ $ni=ImageCreate($ftoW,$ftoH); ImageCopyResized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); } }else{ $ni=ImageCreate($ftoW,$ftoH); ImageCopyResized($ni,$im,0,0,0,0,$ftoW,$ftoH,$srcW,$srcH); } if(function_exists('imagejpeg')) ImageJpeg($ni,$toFile); else ImagePNG($ni,$toFile); ImageDestroy($ni); } ImageDestroy($im); }
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ