×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÔõôÉèÖÃͼƬÖÊÁ¿

×÷ΪһÃû¿ª·¢Õß £¬ÎÒÃÇÔÚÍøÕ¾¿ª·¢Öо­³£»áʹÓÃͼƬÀ´¸»ºñÒ³ÃæÄÚÈÝ¡£¿ÉÊÇ £¬µ±ÎÒÃÇÔÚʹÓÃͼƬµÄͬʱ £¬Ò²ÐèҪעÖØͼƬµÄ¾ÞϸºÍÖÊÁ¿ÎÊÌâ¡£ÓÉÓÚ¹ý´ó»òÕßÖÊÁ¿²»¸ßµÄͼƬ»áÓ°ÏìÍøÕ¾µÄÐÔÄܺͼÓÔØËÙÂÊ £¬Õâ¹ØÓÚÓû§ÌåÑéÀ´ËµÊÇÒ»¸öµ¹Ô˵ÄÒòËØ¡£

¶ø¹ØÓÚʹÓÃthinkphp¿ò¼ÜµÄ¿ª·¢ÕßÀ´Ëµ £¬ÔõÑùͨ¹ý´úÂëÀ´¿ØÖÆͼƬµÄ¾ÞϸºÍÖÊÁ¿ÊÇÒ»ÏîÖ÷ÒªµÄÊÖÒÕ¡£ÏÂÃæ¾ÍÈÃÎÒÀ´·ÖÏíÒ»ÏÂthinkphp¿ò¼ÜÖÐÔõÑùÉèÖÃͼƬÖÊÁ¿µÄÒªÁì¡£

ÔÚthinkphp¿ò¼ÜÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃͼƬ´¦Àí¿âÀ´²Ù×÷ºÍ´¦ÀíͼƬ¡£ÆäÖÐ £¬Think\ImageÀà¿ÉÒÔ×ÊÖúÎÒÃÇÍê³É´¦ÀíͼƬµÄ¹¦Ð§¡£¶øÔÚʹÓÃThink\ImageÀàʱ £¬ÎÒÃÇ¿ÉÒÔͨ¹ýsetQuality()ÒªÁìÀ´ÉèÖÃͼƬµÄÖÊÁ¿¾Þϸ¡£

setQuality()ÒªÁìµÄʹÓ÷½·¨ÈçÏ£º

use think\Image;

...

$image = Image::open('image.jpg');

$image->setQuality(50);

$image->save('new_image.jpg');

µÇ¼ºó¸´ÖÆ

ͨ¹ýÕâ¸öÒªÁì £¬ÎÒÃÇ¿ÉÒÔ½«Í¼Æ¬µÄÖÊÁ¿ÉèÖÃΪ50 £¬È»ºó½«´¦ÀíºóµÄͼƬÉúÑÄΪnew_image.jpg¡£

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ʹÓÃsetQuality()ÒªÁì֮ǰ £¬ÎÒÃÇÐèÒªÏÈʹÓÃImage::open()ÒªÁìÀ´·­¿ªÒª´¦ÀíµÄͼƬ¡£È»ºó £¬¶ÔͼƬ¾ÙÐÐÖÊÁ¿Ð޸ĺó £¬ÎÒÃÇÐèҪʹÓÃsave()ÒªÁ콫Ð޸ĺóµÄͼƬÉúÑĵ½Ö¸¶¨µÄ·¾¶Ï¡£

ÔÚÉèÖÃͼƬÖÊÁ¿Ê± £¬ÎÒÃÇÐèҪעÖØÒÔϼ¸µã£º

ÉèÖõÄͼƬÖÊÁ¿ÖµÔ½Ð¡ £¬Í¼Æ¬µÄÎļþ¾ÞϸҲ¾ÍԽС¡£¿ÉÊÇ £¬ÖÊÁ¿Öµ¹ýµÍ»áÓ°ÏìͼƬµÄÇåÎú¶ÈºÍ¾«¶È¡£

ÔÚ´¦ÀíͼƬʱ £¬ÎÒÃÇÐèҪƾ֤ҳÃæÒªÇóºÍÐèÒªµÄÇåÎú¶ÈÀ´Ñ¡ÔñºÏÊʵÄÖÊÁ¿Öµ¡£

ÈôÊÇͼƬµÄÖÊÁ¿ÒѾ­ºÜ¸ß £¬ÄÇôÔÙ¶ÔÆä¾ÙÐÐѹËõ´¦Àí¿ÉÄܻᵼÖÂͼƬʧÕæ¡£

ͨ¹ýʹÓÃsetQuality()ÒªÁì £¬ÎÒÃÇ¿ÉÒÔÇáËɵؿØÖÆͼƬµÄÖÊÁ¿¾Þϸ £¬´Ó¶øÌá¸ßÍøÕ¾µÄÐÔÄܺͼÓÔØËÙÂÊ £¬Í¬Ê±Ò²°ü¹ÜÁËÓû§ÌåÑ顣ϣÍû±¾ÎĶÔÄãÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇthinkphpÔõôÉèÖÃͼƬÖÊÁ¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ