當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


PHP Imagick queryFormats()用法及代碼示例


Imagick::queryFormats()函數是PHP中的內置函數,用於獲取Imagick支持的格式。

用法:

array Imagick::queryFormats( string $pattern = "*" )

參數:此函數接受單個參數$pattern,該參數保存要與格式匹配的模式。


返回值:此函數返回一個數組,其中包含Imagick支持的格式。

異常:該函數在錯誤時引發ImagickException。

下麵給出的程序說明了PHP中的Imagick::queryFormats()函數:

程序1:

<?php 
  
// Create a new imagick object 
$imagick = new Imagick(); 
  
// Get all the formats 
$formats =  $imagick->queryFormats('*'); 
print("<pre>".print_r($formats, true)."</pre>"); 
?>

輸出:

Array
(
    [0] => 3FR
    [1] => AAI
    [2] => AI
    [3] => ART
    [4] => ARW
    [5] => AVI
    [6] => AVS
    [7] => BGR
    [8] => BGRA
    [9] => BGRO
    [10] => BIE
    [11] => BMP
    [12] => BMP2
    [13] => BMP3
    [14] => BRF
    [15] => CAL
    [16] => CALS
    [17] => CANVAS
    [18] => CAPTION
    [19] => CIN
    [20] => CIP
    [21] => CLIP
    [22] => CMYK
    [23] => CMYKA
    [24] => CR2
    [25] => CRW
    [26] => CUR
    [27] => CUT
    [28] => DATA
    [29] => DCM
    [30] => DCR
    [31] => DCX
    [32] => DDS
    [33] => DFONT
    [34] => DJVU
    [35] => DNG
    [36] => DOT
    [37] => DPX
    [38] => DXT1
    [39] => DXT5
    [40] => EPDF
    [41] => EPI
    [42] => EPS
    [43] => EPS2
    [44] => EPS3
    [45] => EPSF
    [46] => EPSI
    [47] => EPT
    [48] => EPT2
    [49] => EPT3
    [50] => ERF
    [51] => EXR
    [52] => FAX
    [53] => FILE
    [54] => FITS
    [55] => FRACTAL
    [56] => FTP
    [57] => FTS
    [58] => G3
    [59] => G4
    [60] => GIF
    [61] => GIF87
    [62] => GRADIENT
    [63] => GRAY
    [64] => GROUP4
    [65] => GV
    [66] => H
    [67] => HALD
    [68] => HDR
    [69] => HISTOGRAM
    [70] => HRZ
    [71] => HTM
    [72] => HTML
    [73] => HTTP
    [74] => HTTPS
    [75] => ICB
    [76] => ICO
    [77] => ICON
    [78] => IIQ
    [79] => INFO
    [80] => INLINE
    [81] => IPL
    [82] => ISOBRL
    [83] => ISOBRL6
    [84] => JBG
    [85] => JBIG
    [86] => JNG
    [87] => JNX
    [88] => JPE
    [89] => JPEG
    [90] => JPG
    [91] => JPS
    [92] => JSON
    [93] => K25
    [94] => KDC
    [95] => LABEL
    [96] => M2V
    [97] => M4V
    [98] => MAC
    [99] => MAGICK
    [100] => MAP
    [101] => MASK
    [102] => MAT
    [103] => MATTE
    [104] => MEF
    [105] => MIFF
    [106] => MKV
    [107] => MNG
    [108] => MONO
    [109] => MOV
    [110] => MP4
    [111] => MPC
    [112] => MPEG
    [113] => MPG
    [114] => MRW
    [115] => MSL
    [116] => MSVG
    [117] => MTV
    [118] => MVG
    [119] => NEF
    [120] => NRW
    [121] => NULL
    [122] => ORF
    [123] => OTB
    [124] => OTF
    [125] => PAL
    [126] => PALM
    [127] => PAM
    [128] => PANGO
    [129] => PATTERN
    [130] => PBM
    [131] => PCD
    [132] => PCDS
    [133] => PCL
    [134] => PCT
    [135] => PCX
    [136] => PDB
    [137] => PDF
    [138] => PDFA
    [139] => PEF
    [140] => PES
    [141] => PFA
    [142] => PFB
    [143] => PFM
    [144] => PGM
    [145] => PICON
    [146] => PICT
    [147] => PIX
    [148] => PJPEG
    [149] => PLASMA
    [150] => PNG
    [151] => PNG00
    [152] => PNG24
    [153] => PNG32
    [154] => PNG48
    [155] => PNG64
    [156] => PNG8
    [157] => PNM
    [158] => PPM
    [159] => PREVIEW
    [160] => PS
    [161] => PS2
    [162] => PS3
    [163] => PSB
    [164] => PSD
    [165] => PTIF
    [166] => PWP
    [167] => RADIAL-GRADIENT
    [168] => RAF
    [169] => RAS
    [170] => RAW
    [171] => RGB
    [172] => RGBA
    [173] => RGBO
    [174] => RGF
    [175] => RLA
    [176] => RLE
    [177] => RMF
    [178] => RW2
    [179] => SCR
    [180] => SCT
    [181] => SFW
    [182] => SGI
    [183] => SHTML
    [184] => SIX
    [185] => SIXEL
    [186] => SPARSE-COLOR
    [187] => SR2
    [188] => SRF
    [189] => STEGANO
    [190] => SUN
    [191] => SVG
    [192] => SVGZ
    [193] => TEXT
    [194] => TGA
    [195] => THUMBNAIL
    [196] => TIFF
    [197] => TIFF64
    [198] => TILE
    [199] => TIM
    [200] => TTC
    [201] => TTF
    [202] => TXT
    [203] => UBRL
    [204] => UBRL6
    [205] => UIL
    [206] => UYVY
    [207] => VDA
    [208] => VICAR
    [209] => VID
    [210] => VIFF
    [211] => VIPS
    [212] => VST
    [213] => WBMP
    [214] => WMF
    [215] => WMV
    [216] => WMZ
    [217] => WPG
    [218] => X
    [219] => X3F
    [220] => XBM
    [221] => XC
    [222] => XCF
    [223] => XPM
    [224] => XPS
    [225] => XV
    [226] => XWD
    [227] => YCbCr
    [228] => YCbCrA
    [229] => YUV
)

程序2:

<?php 
  
// Create a new imagick object 
$imagick = new Imagick(); 
  
// Get all the formats with pattern related to 'PNG' 
$formats =  $imagick->queryFormats('PNG*'); 
print("<pre>".print_r($formats, true)."</pre>"); 
?>

輸出:

Array
(
    [0] => PNG
    [1] => PNG00
    [2] => PNG24
    [3] => PNG32
    [4] => PNG48
    [5] => PNG64
    [6] => PNG8
)

參考: https://www.php.net/manual/en/imagick.queryformats.php



相關用法


注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | Imagick queryFormats() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。