首页 >函数列表 >imagecreatefromstring

imagecreatefromstring

imagecreatefromstring

(PHP 4 >= 4.0.4, PHP 5)

imagecreatefromstring从字符串中的图像流新建一图像

说明

resource imagecreatefromstring ( string $image )

imagecreatefromstring() 返回一个图像标识符,其表达了从给定字符串得来的图像。图像格式将自动检测,只要 PHP 支持:JPEG,PNG,GIF,WBMP 和 GD2。

返回值

成功则返回图像资源,如果图像格式不支持,数据不是认可的格式,或者图像已损坏则返回 FALSE

范例

Example #1 imagecreatefromstring() 例子

<?php
$data 
'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
       
'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
       
'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
       
'8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$data base64_decode($data);

$im imagecreatefromstring($data);
if (
$im !== false) {
    
header('Content-Type: image/png');
    
imagepng($im);
}
else {
    echo 
'An error occured.';
}
?>

参见


  • gd_info
  • getimagesize
  • image2wbmp
  • imagealphablending
  • imageantialias
  • imagearc
  • imagechar
  • imagecharup
  • imagecolorallocate
  • imagecolorallocatealpha
  • imagecolorat
  • imagecolorclosest
  • imagecolorclosestalpha
  • imagecolorclosesthwb
  • imagecolordeallocate
  • imagecolorexact
  • imagecolorexactalpha
  • imagecolormatch
  • imagecolorresolve
  • imagecolorresolvealpha
  • imagecolorset
  • imagecolorsforindex
  • imagecolorstotal
  • imagecolortransparent
  • imageconvolution
  • imagecopy
  • imagecopymerge
  • imagecopymergegray
  • imagecopyresampled
  • imagecopyresized
  • imagecreate
  • imagecreatefromgd
  • imagecreatefromgd2
  • imagecreatefromgd2part
  • imagecreatefromgif
  • imagecreatefromjpeg
  • imagecreatefrompng
  • imagecreatefromstring
  • imagecreatefromwbmp
  • imagecreatefromxbm
  • imagecreatefromxpm
  • imagecreatetruecolor
  • imagedashedline
  • imagedestroy
  • imageellipse
  • imagefill
  • imagefilledarc
  • imagefilledellipse
  • imagefilledpolygon
  • imagefilledrectangle
  • imagefilltoborder
  • imagefilter
  • imagefontheight
  • imagefontwidth
  • imageftbbox
  • imagefttext
  • imagegammacorrect
  • imagegd
  • imagegd2
  • imagegif
  • imagegrabscreen
  • imagegrabwindow
  • imageinterlace
  • imageistruecolor
  • imagejpeg
  • imagelayereffect
  • imageline
  • imageloadfont
  • imagepalettecopy
  • imagepng
  • imagepolygon
  • imagepsbbox
  • imagepsencodefont
  • imagepsextendfont
  • imagepsfreefont
  • imagepsloadfont
  • imagepsslantfont
  • imagepstext
  • imagerectangle
  • imagerotate
  • imagesavealpha
  • imagesetbrush
  • imagesetpixel
  • imagesetstyle
  • imagesetthickness
  • imagesettile
  • imagestring
  • imagestringup
  • imagesx
  • imagesy
  • imagetruecolortopalette
  • imagettfbbox
  • imagettftext
  • imagetypes
  • imagewbmp
  • imagexbm
  • image_type_to_extension
  • image_type_to_mime_type
  • iptcembed
  • iptcparse
  • jpeg2wbmp
  • png2wbmp
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道