如果图像部分太大,我正在尝试调整图像大小。我已经编写了代码并且我已经完成了,除非我使用imagepng它只会显示随机字符和符号。我不完全理解为什么会导致这个问题。我记得过去曾经遇到这个问题而且从来没有修好过。
ResizeImage类:
class ResizeImage{
private $image;
private $imageResized;
private $width;
private $height;
private $imageSupport;
private $imageType;
public function __construct($image){
$this->imageSupport = array("jpg", "jpeg", "png", "gif");
$this->image = $this->openImage($image);
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
}
private function openImage($file){
$fileTypeSize = explode(".", $file);
$this->imageType = $fileTypeSize[count($fileTypeSize) - 1];
switch($this->imageType){
case 'jpg':
case 'jpeg':
$image = imagecreatefromjpeg($file);
break;
case 'gif':
$image = imagecreatefromgif($file);
break;
case 'png':
$image = imagecreatefrompng($file);
break;
default:
$image = false;
break;
}
return $image;
}
public function resizeImage($newWidth, $newHeight, $option="auto"){
//Get optimal size based on $option
$optionArray = $this->getDimensions($newWidth, $newHeight, strtolower($option));
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
if($option == 'crop'){
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
}
}
private function getDimensions($newWidth, $newHeight, $option){
switch ($option)
{
case 'exact':
$optimalWidth = $newWidth;
$optimalHeight = $newHeight;
break;
case 'portrait':
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight = $newHeight;
break;
case 'landscape':
$optimalWidth = $newWidth;
$optimalHeight = $this->getSizeByFixedWidth($newWidth);
break;
case 'auto':
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
case 'crop':
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function getSizeByFixedHeight($newHeight)
{
$ratio = $this->width / $this->height;
$newWidth = $newHeight * $ratio;
return $newWidth;
}
private function getSizeByFixedWidth($newWidth)
{
$ratio = $this->height / $this->width;
$newHeight = $newWidth * $ratio;
return $newHeight;
}
private function getSizeByAuto($newWidth, $newHeight)
{
if ($this->height < $this->width)
// *** Image to be resized is wider (landscape)
{
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
}
elseif ($this->height > $this->width)
// *** Image to be resized is taller (portrait)
{
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
}
else
// *** Image to be resizerd is a square
{
if ($newHeight < $newWidth) {
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
} else if ($newHeight > $newWidth) {
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
} else {
// *** Sqaure being resized to a square
$optimalWidth = $newWidth;
$optimalHeight= $newHeight;
}
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function getOptimalCrop($newWidth, $newHeight){
$heightRatio = $this->height / $newHeight;
$widthRatio = $this->width / $newWidth;
if ($heightRatio < $widthRatio) {
$optimalRatio = $heightRatio;
} else {
$optimalRatio = $widthRatio;
}
$optimalHeight = $this->height / $optimalRatio;
$optimalWidth = $this->width / $optimalRatio;
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
{
// *** Find center - this will be used for the crop
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
$crop = $this->imageResized;
//imagedestroy($this->imageResized);
// *** Now crop from center to exact requested size
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
}
public function saveImage($savePath, $imageQuality="100"){
$fileType = $this->imageType;
switch($fileType)
{
case '.jpg':
case '.jpeg':
if (imagetypes() & IMG_JPG) {
imagejpeg($this->imageResized, $savePath, $imageQuality);
}
break;
case '.gif':
if (imagetypes() & IMG_GIF) {
imagegif($this->imageResized, $savePath);
}
break;
case '.png':
// *** Scale quality from 0-100 to 0-9
$scaleQuality = round(($imageQuality/100) * 9);
// *** Invert quality setting as 0 is best, not 9
$invertScaleQuality = 9 - $scaleQuality;
if (imagetypes() & IMG_PNG) {
imagepng($this->imageResized, $savePath, $invertScaleQuality);
}
break;
// ... etc
default:
// *** No extension - No save.
break;
}
imagedestroy($this->imageResized);
}
public function loadImage(){
$image;
switch($this->imageType){
case 'jpeg':
case 'jpg':
$image = imagejpeg($this->imageResized);
break;
case 'png':
$image = imagepng($this->imageResized);
break;
case 'gif':
$image = imagegif($this->imageResized);
break;
default:
$image = false;
}
return $image;
}
}
我在我的代码中调用loadImage()。现在我得到的输出是。
‰PNG IHDR–ps~* IDATxœí}ypÇyï×=ÇÞXìâ¾II¼‰4)ò‰:-+:[–”<Ù)Ee=;©g§Ê±c;ò{%_e»R±¥ø%O±äg˧$G’Y’©H"ƒ¤xAI‰Å]ì½;WïÙ=È"ªÐ5µ˜éùMwOýõïûº{‘¦PS&,pá³`~¼Lj‹\ ©Ç#"5¢ qzŒ!ãòá=€çÞ³ü.sÖ—\FÒF<-zÛxòeƒˆf!ž_\ê·hj"Š5¬+lQ\0`a¡™c,-¢°\\¦õýR€K•|q‚KÅä%²Ä…‹¼Ä…—/ë%.\âÂ%.¼Bèm‰ç'½Í¼Ä…—/ë%.\âÂ%.¼Bèm‰ç'½Í¼Ä…—/ë…âBR¦ÒÍÏ2‡ dŽàR¿¥R˜…ÓçgggSƒXios¯«´·‹¦lÜK™/3¸¨8K¾ŒØ cÁ—e/ žUBÞúƒ/ ü«¤Æ A@xξ¹ñþ55·éÕ\¶¹¤¼ààR1@.DÄsÁß¿qþ{ˆ€A@i°¡æþ-Ëî.¬ÁÂD`‰Š“JðHàߘ.?@zAPŽ~b|f hït™Ë9_ð\¸ð⎄ßL)@=SÐ3ÎDôýFUU£HEÓ,l….Õyš¿0’A$Æ#-Dmthìäììl™’MyÁÁ¥b̉ðæX³i`yr.ü'‚õ2 0U““JPÖ’€(pv‡P%p´0Aa2$T§vù1Þ7Fü~?Çq¥ P¾r%úRÃTDDÞ[4é9šïl)¨¬Å/„ßê¾Lô),ÉPB8ŽÚ|ö¶öªkÛý{‚¯hún±‰þö"BÒIuvŒDÂÆÏ[ðy•ó2ƒçÂ…åÞǬ—†ýùíÅr~QpÑ_6zõèèÑô˜‘9d’Ò4-1•8=ï=ø醦O¬©ý3³[²®wmÒ$;'ÊÀP7Fum¤dàdŒE;DQ,UCt²¼h™/¸Œkž–z}è{ÿ5ðHzLW$$€ÑêôÒ,òvà_ÿãØ¢‰iú\Muì†T\£ ɤÀ‹d*9æj®_Q__oô¢$.¤–ØËÉ… ©±—ú¾Ú7ý¢©YS2〹Q!Bœï}êèßÎDæVI)·©ý6epÓX¿ŒõƉž=yû)¬uvoÙ²µ¡¡¡|«Z´\!O›‹",I̽—ŸXc꫃ßî¾’y"kˆ¦jˆ€¥`“–ß±é».‡×hÚ²,Ÿ>‹Åxž¯¯¯w8fI}AËë—ºu™Á¥‚YÆ6Fzbü©7ÏÿŸl)JK,/Þ¸ )ho¹ïÆoXüÝœcŒ€n¿”±ë,.BðEufaÆHXð5ÌJ1cÅ`±Ã4l–#'áC£cç-™B(¥<ÏuçÞθŒ¤s¦\ùç!_6z·æÖãÒÌLb€dD€u§Îz0Ô‘&°>CírïàaMÓ,éù6¬BØb[·¨tÆ/%‡Mʃä;9!eü0K”˜ÎlN~hôt2™,ßÖà•.cNdaü„b,Û7Z£«R=A¤3¡‰x<^ªåëkñƒ/-‰àB‘jLÕ†PÞð„ˆ±y!Éd2•J]4GK9¯ðâåBŽØš¸¬¶!˜4òâe…)SÅÈkî$TJ½Ô|Áó*Fyð\¸paÖθÄUE^„rö+f5/siUVŒ)¥ cÉMž™¤ÆÂÉ‘hz4©Î0”9bwru[ƒ×Ñd·¹_DV“3‰sãÑwRJˆ§Îgw{½Ó^QØ÷̽s—Š1WìÂÌú-<ºÒ9ÙdDfˆÊèî‹ù…ˆ@( OI~¾ZŸ‚(Z€¢ .%ÏöN=Ûz1©N› E¤±Õ~ãê†ë+½Uæ¡8Æ´ÓSÏû±Ê¤lÜÓu¶«w´þmeEÇñ—š‹>bèîÂø….»¯’v2 éîæü ýÒ8!²ü» K,E£Ãá˜K¦zñ©‘ÿzøÄä“qe:?;–`ÓÉÇ=215¢è55zíÑWXÖ„@À éÍ7/|jfLÓ´R–àE«k.^¤\H ]S»/•Ò,NBés‚˜ÂÓ’:ãojlr¹\–ô‹ò "FÓc¯}s,~‚fÄ°Iíàþelb„1†ˆ*“NNüŠ@ÀŽ€ éPïÀ¡D"Qø‚—“l¾p}û^.ÞÀ˜© Ìç˜WÁ/‚¦âðÉDsUkk«>zQ^Q™t8ðøT²Ï¢å†®#f=HÞ9<ðëÙð,(Z"”B H H‚„ aç'{"‘Hù:±Ü*ß©–¹µ¸üB°Ûì»Úþ*<΀äk^NpKè%íÇúª×¬ZÛÒÒbH+Å+ˆ8;=>XÒËDÂÐðDq’8sî„,Ë’¤™úO뉄‰Da»¿œ~á‚#¥”®]±m9cxZ&”ähÉÌ…ÅÎ GB“éþ×`Eӆ͛7WUUÍÉEe t@e*C€èË?ôôI $†¦„#aï¬[Œ"šÆˆ’p†ÏÌ…†«ÄIZ"œ›IOÆû'cç¦C³©Ñ”e¨™=*½dn·ûÚMw¹f¶ÌÒ”£$w ɻ̔£3Ô‰çÓµB÷Î;Vv¶Šª&©š¬1•!³ømFá5M™Nô!Ú¢DÔá`0( ¶ÎÊÐÂñ‡xÀW_¹ÒårYªÈòÅÚ÷bñ€1MÒ’ƒ¡·G"'¦q9”CˆºÍ€ê|nÑWãZÑ\ѽ¢êj;ï¡„JiccÓ‡¯úÔ³¯pCÓo4¯ur|ìøøï†ÃÇ4̼±¶UÌJ#S7á[*Öoh¸y™«w€,Ë}}}¯¼þâÉÀœË"ÕvÁ®O°gê–i(KlúBrøp*8¬ØÜjK·¸bc¥¯ÖFùìÒ(@d¨*È4´“ê•U{7¶|¤ª¢‘çýåSrä×ï~.,](Ue…!u¾öê†vìØ)B$>Õÿö@ð`$5.%"uU7mÜÜÜÜl³Ùô¾´|uAæ.…Dc¢ø¢ìU˜„¢¥OMí{ä©P*`jµ˜ù¤HzH¼¶úí-í®ßgãÜŠ¢£Gß9zòÐ…P/ºÃœC¦ &£§‰I.6-ÉtÖßÄ-ëö6u¸]^’i2$—6 †RZã5ï†ú;¶,»Õ[á'„¤åÄóg‹ŸÈ´§L%!b&Ì9Óâ$Î4ïí¼Û¶í¢("b*• …B¡Ù ,)n·»ªªª²²’ç‹øõEëæÃPLeKç½væBøä+CÿwËÜS5ŽÚV§·Ú&بþŽŒ¡ª0MEdH)áx ”RšÊRqNÜxÃÚÏ6Ö,GÀ7†|tê—s©D½à©#ëoýo÷uuué}²…e˜œZ,Úµ3ÕWtdô75ýQ€ìw|ÆàÌ,¥ÎÈ2#M’—xNI PàÖ×Þ´·í¯v'c,™L†B¡p8œL&c)5òÖ…Ÿ†µ_t¸yN¤™&ÂÊäùDx*N¨ˆèàœ^Þ[c÷×ÛnAoR©¸jK7Þºî‹í-]£ÁsÏ}IfIsÅXú#$'ÄšàÍùðíæ~²°~ÊÜúÓÁ¥‚YÆsåÂHzú7§¾ˆžÐ#Íïž{ £šh–qOsÕ«Ò!T‹+îìþRmE[¦¹0€²–úmï·gßäø<ƒPSÙh_ì|o”)è©=~Ñá(ŠÌ䔪š¾:;¡Rq…7|lë?6Öµ½Ö÷ĩسùÂ*˜ á·V\Õ]Û·ow:¥¨à=ÒÛ¼ÀïΦÆÑóÁäùòHsJ!HFg2:È Ãœmc!à"uíúJkÍj=†1íàÐOÞ¸ðSš]ÿ ÆO„‡{ÂÞj[ý OeMtpO !Œ¡*kɘŸ•+ªlÞZ»þâ“×b÷?ÕþpîÑqí h.‚Ù F ‚ïTwUßpýu7444”Zzúžém^à÷ œžüÉñ¿ŸMÍBï;ó¡yn¥DSYd*žJKqUS¡D´sž*›¯Ñasò¨™]¤¬tؘÿ®îÿÕZ³ F§~~üï‘6ÕÿŒõÇμ1]ÕälíòzªD‹‚"È)5’^ÁåôÏcfǤíUyÓÎ{‚áÉ×~:o!U_Y‰sÑwk;|»®Ù½gùòå‚ \"z»|\—g?úw¡T€,Òb Éý„€*³Ñ³Ñ#Áè´¤iú€"J(%œ@í.¾¡ÓÓ¶¾Òå39›zYBÀ¦UßÝýp}UÓ¯O~m(|˜rúÈd&ÏTLéyu’¬ÜRå±QÎPË[€”TÓ Õíy‘Uf±ó¶ûv~kUǚ险£g_ˆ¿žÆÀ–&”1…(QAžª°GÚ»VnÞ´qSss³ ¥*ÝRW‹—Múéñ/ŸŸÈÔ_¦º³D‡³6uõ#$zöON ÇçµWÔØ^9ʦ¡*iɈŸ•‘aû&ËZ/åL_fRD/¶ïYq÷o¾TƒZ Âø¹èàÑвu¾ºnAä t`Ó (qx½ø¡±äZñŽ^wEEE"‘½ž˜Å£LE—Ó]S]×ÚÒÖÔÔäõz +ôRÐÛ¼ÀïñåþÇ^øyNJ¥—¸p¡göØïǙʪ[]u+=þF§£BàEª3""0 U™¥¢òìX*Húêí+·U 6ÎRMe˜°{Jpp`"ND<÷öL<(w\UåñÛò^Ìl`eS“Óš¦1»[W&SZj°ò¯¯ÿzÇÊNJ©¦i²,§Óiýnžçm6›ÍfÓ…wQÞZ<\XüûBD¼9ýÆÈÓ:ñ@ù"\x7|ôw£¢ƒoÞäo\U᩶ñ"gùÞ–@°svஶW6:'ú£ƒÇfWl©¢|ž7Iy*I9¦¹yJ8b$€J ÍáD'„äoCh@€ò”!‚@Åñ¡@_kK›Ãáàyžã¸¢ÓÅsa,ÃS¼¤à2ŠkŠÏj¨þgß¿ªLÖ'É”<™Oõ쟰»…WU/ßì÷68ucÎtoã*müHÉx(1&ä á<’L¨™9 DCÂDO9j™‡ÊNîƒ1í‡HÊ0 )¡?mLÒÒ"Ù¦æ_(ÑR¾tàR1æDŠÌ"bÏÄë#‘Ó˜7SdšT¯2Uf§^›D€¶MUk*í"£Þ‹Ìè‘@‰Ã+6tzS 56#ÆÌb&‚ƒKÅUYf cúl%€£RT¦ªXªI™MË—+Nä"‰Ù´”.¬”¢aŽìuéÀe¸Ðˆ/Ò‘OL'.fÅ8 wŽY±cpá䬻ÊV×Qa¯€@~Çe;a@Bœ•"'R)©B~Û‡GHFUIb ‘qUÙƒT<ÛÁ³Áƹ•!Ð0w%’")²‚ïë¬Þ¥—ê<Í€"CoŽ<€y“¬‡^ûbA)’«ZÝî;¡Ôè{MÚ–SDfUD‚Hˆ«Ê–Š«ŒäÍÇ2ÑÅ3†©¸jЛ½Btøl± ¤(¨O¯#è&²“ïj$CÆp.ÔUE¦ïšŒpÅsaBŽ„Nd;Ÿ‹p!žJó"õ6:;o_ÆŠëEÉvÒœSUDfMìn!’•1 ਷ÑÉb!I_üǬƒèòS4`œ.Wd,C´RJå‰Í²iŠ±/x4& >IÁâdF SlÁáµéÓh^ ÌÓKB'R¦ç’×^!HIMJjú¥Æ€wð .Yb±$ËšÆòxQc¨j¨¨˜UPSûcˆ¨n›Ï¼t¸|¸"¸0Ï/T˜|vúÔG @f")7&šõÜ2usÔæx‡æ;^v6ÛR·áižë™ó ¥$U—ywŽÊ %Uy 6J9 P·zG3£~y˜Éu5͆/¸ ®Þ¼ÀsñóD˜”##‘³@rÕ[â$—åoçOÐ>1·8ž2†„fg ²2&„Øœ\",»j”Ëíš@EÎ&PMaŒ¡¬hLŸZ"чUÑÒ˜IS£´{…Ûížc˜—Š1÷®yßTDÒ¡™ÄDf#HsÆâ9ÁÉ«šæ±’œ •Œ)¼J@fÿ-fºM€·QiFÖT”ËÇ„òœŽÌ%ÉŒ¢˜[ÈDªŠ¶´µ,7ïž`®šEË…E1ìؼE´¡ä”¬I”+X¡PG…Œ*Œ+x 0‰’—™Õ+…· áDN•4EF"˜ b.‘ÑÚÍËý"š¤‡^¾£±±QŸ‚˜K¸"¸0Ï©´CfrŠ{óˆ™x¡ÓoBT…•sá/z%EóÂMaŠ¤å;yæRÖÚ“A”‰Ö?çÇàpܧ4oîÞæóùÌMØø5*åŠóó¸PcjÎ*ÈëÎò[€@»G°{%Ù2ËUÞc új´‚ÞX/¦¦¡,ivD4ç‘Ó6ƒ#ͺ˜]ߟNÏö§ïÚrËÊ•v»½¼\Ù\¨ÛA¬ó ŒAeƒ36+;üH©ÉÉõe¹ò»9SáëbÌN'3 4Š~õôŒ©ˆ2q*ruóõ;·ïÒ÷€Êá>x\@L-=WÛÅÖf2‡Ï–J¨JZ|Ö Ñ B½Õr$Ñϳ@ Æ&^–’0JZe"f÷M/RŽbm0”Æ{f»œÛnÙsûòìBŠ¢/R4,8xÞ\H€3¾ÃB!GÖ*j©ˆ¬i`|b¢£Ì#™ºËæÁD¤Ùý*ÍÄ‹FLeRLM†$MCÓ8‘Ù£7> ÍEj*› $ï×¹¯¾ë†¿\»vm©Ï?P\(P²Ìv>yÄ”¿Þ)_M€p"õT;aÉá³e|;0™Ž38Ñô$Ñ‹˜Ý>² ¯3YfCXM…îºmqÎŽÄœUvÑ)óÀÆ[ë?>U1“gÏÇäQ¼~Õ7ï¹µ£££¢¢Bw„«Æ®l.¬´WQªùÔo—È*k×ð"uûmɘ"º³Zayå $cˆÏ++{5+k:oýðm‡G^ÿ}ÏsÛ½¢àÇe‚&krR•ãj|2™žR:}Ý·Ü|ÇÆõ›šššJ™0@.ôˆ~7õÇØTÞÚIÓòlk0–ú""¥ÄY!¨ "…ðL hþ²ïR1P¢àõT6Ô5|r̓×oøÈï=÷öðÁÐÌ”d—'Ï "j2“¢²Q…´½Óµášë¯ë^½®¹¹Ùãñ˜÷S‡² ¿0,8x.\˜×‘ºm Îöpb’ˆ¤P‡ ~ëM}0•çuæC,0Rôîý„…,Zx=¦1¼Í•v»]Ŷ¦åá»ÿÚ‰›ûÏŸš˜K¦’ªª n»§¶¹®©®¹yYkK«ÏçÓ¿Y)Ú¨ßß‘ÌK¶tž…—V.tˆÎÕÕß¾ÁYû6K-¸ f[‘B2³½÷Òx ¢a u=ô¹cŠÌÄd…ßï·ÙlzÚn—»½mEc]ÓUÒY–UUeŒB(¥‚ زAÿ¾-“ïb¢·KË…”ÒÍí;~ÝûohG‹ÍÞ\a¶ygøÖ…°¬ê«Ò²&‘Ù/0Ù<± ©Vh¨©5/Ìçy·Û}Ñ—_„ôö¾sažŸK©®¨mubÌ2´–gsäßÊUxÖé(b @þ³Y4g¸˜-4Ť.@}uCmmm!¥• %rΫ¯9†Ïß/$„Rº·ó–tBE‹¨ò\Á±SC~¤4Øò)‘T¶ÑH„e1\ÙÖ²Ìçó¯d9aŒišfìß³x\=}{?1åR=ŠPd)ð–e;~v¸Ýq“kaq ¹‹˜ºÉRà"ŒW¬W΀)GBç’ËÝkÚÛÛu¯<ï6!011qàÀH$"Š¢ËåZ¹råúõ다uyé %-=:»ºzG¬ÿ_è}çÂ"ëHçMKE ±Ì†VÍ\ìÒâ!‰Œx:–¯jmm5Æ,/öæ›o>ýôÓ¡Phzzº§§çë_ÿúÁƒuë¦ðUË3Ê\Àæxã‘D"‡-*rfúÝ_ŸúIRI”IYeêd|Ü0G‹C¿DÄ©ø„¢)…‰X¹0#UJ÷®½Ñ#×2MO1¯»ë/ЇWr\XÎÇøk|ßW\·™†ÁS©Û²®®®êêj(qùòåŸýìg?ÿùÏéK_ºçž{¾ÿýï÷õõ•ÂC¾lc½½½Ð·†..c¯¼òÊË/¿l3Ô^xe tæää;eŠ—¢?>ö/q9†ˆ)%ñòÀóS‰‰Â$„0ÔþãôÏχŠ6…"‹ !Þ ïíkÿ21%g-ÈÜŠD,ñ›Å¢`4OòAÙ‘Xļ¢ãi~´²kÕÚÎÎN›Ífi§æƘ®v¢(Þxã/¾øbQ^ADUUÍy˲|ðàÁ—_~9šÁš¦éÛèY”COÁÂR½½½ƒƒƒfØx|ìôôÉUÕÝû§2ÕR£üj}Á^•)0™ÿå»OŒD†-àÌ9@_ðÔl*h‘.åB]ì”Òk¯y«ïõ¾è»GÈ×lj¸¥Ì#™:¶>Oä”>ªñwlÙ²¥®®®¨*íè8Ž«©©‰Åbú&³”Ò`0èóùDQœššzã7fff ³³sçÎú§L·Ýv[4¬¬Ô :¹º\®îîîõë×ë㌱£GöôôȲ\SS³aÆöövÆØÌÌÇqápxzzÚçóéþ‰ññâÞõýðk_D‡—û:ôÄ“JÂÆÛr8ÊÏ$§(áB©;ïhp7nÇW;«»țƒÁät«·ÝÆÛ$5J5dQ9IÏzí¹)k=p_ûÚ×ÌÂ3z|AÚ*W¼qì êH®ØÇÊEÍ”òÁÄÇ@Œ¡ó¼çâø›ÑÚز=»÷îر£¢¢².D¡äÎœ9öìÙ#Š"(Š²ÿ~¿ß/ŠâáÇŸ}öÙ“'Onܸqttô¡‡r¹\³³³Ï=÷ÜèèèæÍ›9Ž;räHooïºuë!§Nz衇fgg=Ïèèè/~ñ—ËÕÞÞNùÝï~÷裊¢ÈóüÑ£GûÛ߶´´x½ÞÿøÇï¾ûîÖ[ÝnwJIþìä¿ïhÙ»¾~KïôI ÙêênP™úıGÇb_½ûD…r&9ùÿŽÿ0"Ížš:ÑVÙî+^8÷L“§ÕcóŽD†þé͇_8÷›ÉøØÚÚõc±ÀÞúÆTrr tFCÖYÝÅQΨ ,³77¥´¹±å“Wö‘׿áhGÊÃÇ|4O£Š]1AÌ[Úˆ,<uŒÕlܲyûöí~¿Ž~cL–åcÇŽõöö>üðÃÇüñÇ;::|ðAY–¿óïttt<ðÀ~¿_UÕ¾¾¾oûÛÏ<óÌ]wÝ5<<<88¨iÚøøø÷¾÷½Ý»wßsÏ=çøñãýýý>ŸRúÇ?þñ‰'žøô§?½{÷n›Í‹Å^xá…M›6ÝqDZX,Nßÿýú6PóýS‰‰UÕkqCý–c㇮_ñ·èÑP÷¿x}_û-ëë· ²wò±wþù/6<Ðæm—4éÐèwµ]WÇŸ=óK·èþï»þ÷3½?JÑOó'7æߎüÓõ+nÝÚ¸Ã0qš)÷ÿAØÔµåžÙOÿää£î<á²ËÔ0o[NCP–îÖ0W²Ã4YPVù0¿- Àô»QÚëí^µþšk®ikk+Ü-Ä°È3<ÏX<ÿÃþ@éëë;xðàwÞ¹bÅŠ£GÖÖÖ~á_hnn~ì±ÇEyપª€çù®®®@ŽÑ¿IDATüã=öØÞ½{u¢€W_}ÕívßÿýÇõôôüð‡?üÔ§>õ¡}H’¤ýû÷_{íµûöí£”"bEEÅÇ>ö1I’Ahmm««…BíííÀ˜v6xJÒÒ¼ý-%5“#ã±@guÂn_û-wû”ȉˆØQµ†§|»¯ÃcóÊÉ)†ŒPB4¦ÊšìÝŸßùvÞÉQnuu·@Åzwc»Ñl‹êÓEö`s¹\×lß›L&~uúGžN(U+ËØZÑ[P0š='áÔ‰öxº—wï»v_WW—Q¹Eƒ~KUÕ‰‰‰W_}U—ÍßüÍßìÝ»W|}}½ßï€`0ØÝÝír¹ÌãÈ«W¯ý_`Œ555ñ<âĉG}ôŸø„žT"‘Ð%d.¥Ôáp莾ó¬—cÏïßݺoUM7ÂSþ7§vzúä 'RBÖ×o¨*¤„ËYæÈ€î¾MÿãGGùÆëÿð‰uuMÛ¾L¥fø/Sƒ%ÇH¨(¥•••×ノ ýå±Çm+U{¥h]ph EmëÝlç ”ÈImòpÄvÞß½bÝM7ݤ“Š¥$E¹Ðf³Zµê+_ùŠùc]D”$ÉPV›Í6::jišú¾DúÿÒ4ât:'&&z{{yä‘{î¹G—"òÖ}Ÿ×ž±bRäÙ³¿Ü³üïT™Š˜ï¡Cžq«ÿñÚ*ÿ环8¿ÿç=¹×Ö¦@ Õ0Wï¤Ô©¥¶Z«ªªºîš>uÕgù³¾Ù¡8c™i†÷rd\‚QËèXr쥨w´ik÷ö[n¹eëÖÇ\˜2º¨[ž…^,ËƘêž={Î;÷öÛo°T*õÂ/´µµÕÖÖêA)ݽ{wOOÏw¿ûÝ{ï½wÏž=”Òd2yîÜ9»Ý¾yóæ—^ziddD3ÆÂáp.?ÐPÝ?øŸ]5ë=¶ ãÎÕ-×T8;sŠ9QCÕüR˜'JI(ñW‡_b¨]³lßr_GèÃÌ.áEÛ4ÌñùêR¼f×oEåž?ùÎ!W;稲QJ³ÛVÎ% dg G1‘gÏ$XŸ½Åݹeç–]»v^½ZßÞ³ÿŠr!¥Tï ½–AÐã !ëÖ»ûî»ðƒŒŽŽÖ××SJ_zé¥@ ðå/Ùn·ëòCÄÕ«Wß~ûíÏ>û¬$I===étúÅ_ŒÇã_ýêWo¾ùæÞÞÞo~ó›þçîñx¦§§Ÿyæ™mÛ¶\¹RÏW¯å`ræôôÉ¿½úäJëÜkjÖ¿ÔÿÜÆúmáM6J«k`v½+hLcŒiL{¦÷IDyÛ`¨oWë>JË@ŠKg®û‘B*++·mÝVå¯zëÐê×Þ}yB<ï^ns×:)OL#º%e§·B "$‚éð@Bä|jò¶åÛ·o¿êª«ššštßJt›æ ßjooק -àµk×666ê>swçw:ΧžzJÓ4žç×[÷àƒ¶´´èdF)¥”rw÷Ýws÷ôÓO' AÚÚÚ>ó™Ïx<øÜç>÷ä“O>ùä“©TÊëõîرãÞ{ïÕÅõÕWëÛs+LÞÝv]GÕs9)¡7wÜþÊà„ÐÍW×»¶óŽëVÜbç`çí7®¼Íï¬öØ<íº÷™Ó?£„Þ°ò϶5í$@ °mMjp7æCÞ0y¼£¨ð,u§ªj0ŸÏçó¹Ýnc3dKÑZªs[0¥n-fp©`–ñ¼¹°TŠˆ¨(Š¾É<®ºw¥¯y¹¨©R˜ø{îf›s™Ô'¸òOâÂ÷|Â"¤·y碎ó?› ‹¦ö'‚¡Àb¼âÀÅS0ö?› CaÑ/¸TÉ'¸TL^"ï.pá³°øèm^à‹rá‚ýϦ¹ÀÞx³¾à2’6â—¸pQƒ—¸°¸TÉ'¸TÌ.qa±°Ä…K\¸Ä…K\x…ÐÛÎ/,Nz›x‰/_ÖK\¸Ä…K\x…ÐÛûÎ…ÿˆC³Öü($IEND®B`‚
有什么想法吗?感谢您的时间。 =)
答案 0 :(得分:1)
您必须将Content-Type
标题发送到浏览器才能将其呈现为图像。在输出任何内容之前尝试添加以下内容:
header('Content-Type: image/png');
您还可以在imagepng
documentation的示例代码中查看它的用法,以便更好地参考。