(PHP 4, PHP 5, PHP 7)
imagecreatefrompng — 锟斤拷锟侥硷拷锟斤拷 URL 锟斤拷锟斤拷一锟斤拷锟斤拷图锟斤拷
$filename
) : resourceimagecreatefrompng() 锟斤拷锟斤拷一图锟斤拷锟绞讹拷锟斤拷锟斤拷锟斤拷锟斤拷舜痈锟斤拷锟斤拷锟斤拷募锟斤拷锟饺★拷玫锟酵硷拷锟�
锟斤拷锟斤拷锟斤拷锟斤拷fopen 锟斤拷装锟斤拷锟斤拷锟节此猴拷锟斤拷锟叫o拷 URL 锟斤拷锟斤拷为锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街革拷锟斤拷募锟斤拷锟斤拷锟斤拷 fopen()锟斤拷锟斤拷锟斤拷 wapper 锟侥诧拷同锟斤拷锟斤拷锟斤拷渭锟� 支锟街碉拷协锟斤拷头锟阶靶拷锟�锟斤拷注锟斤拷锟斤拷锟矫凤拷锟斤拷锟斤拷锟斤拷峁╋拷锟皆わ拷锟斤拷锟斤拷锟斤拷锟斤拷
filename
PNG 图锟斤拷锟铰凤拷锟斤拷锟�
锟缴癸拷锟襟返伙拷图锟斤拷锟斤拷源,失锟杰后返伙拷 FALSE
锟斤拷
Example #1 锟斤拷锟斤拷锟斤拷 PNG 锟斤拷锟斤拷锟叫的达拷锟斤拷
<?php
function LoadPNG($imgname)
{
/* Attempt to open */
$im = @imagecreatefrompng($imgname);
/* See if it failed */
if(!$im)
{
/* Create a blank image */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
return $im;
}
header('Content-Type: image/png');
$img = LoadPNG('bogus.image');
imagepng($img);
imagedestroy($img);
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
Windows 锟芥本锟斤拷 PHP 锟斤拷 4.3.0 锟斤拷之前锟斤拷支锟斤拷通锟斤拷锟剿猴拷锟斤拷锟斤拷锟斤拷远锟斤拷锟侥硷拷锟斤拷锟斤拷使锟窖撅拷锟斤拷锟斤拷 allow_url_fopen.