當前我試圖使用imagick生成一些圖像,而不保存它們在服務器上,然後輸出到瀏覽器,我選擇的方法是圖像魔術與PHP的imagick擴展。我閱讀了文檔,並確定該軟件包安裝在我的機器上(windows xp,帶有xampp)。該類安裝imagick顯示腳本url而不是圖像
imagick module enabled
imagick module version 2.0.0-alpha
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.3.3 04/21/07 Q16 http://www.imagemagick.org
ImageMagick release date 04/21/07
ImageMagick Number of supported formats: 164
ImageMagick Supported formats A, ART, AVI, AVS, B, BIE, BMP, BMP2, BMP3, C, CACHE, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CUR, CUT, DCM, DCX, DFONT, DPS, DPX, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, HISTOGRAM, HTM, HTML, ICB, ICO, ICON, INFO, JBG, JBIG, JNG, JP2, JPC, JPEG, JPG, JPX, K, LABEL, M, M2V, MAP, MAT, MATTE, MIFF, MNG, MONO, MPC, MPEG, MPG, MSL, MSVG, MTV, MVG, NULL, O, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PFA, PFB, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TILE, TIM, TTC, TTF, TXT, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMFWIN32, WMZ, WPG, X, XBM, XC, XCF, XPM, XV, XWD, Y, YCbCr, YCbCrA, YUV
這是從的phpinfo,所以我知道我已經裝好,事情是當我嘗試生成圖像並保存它,它完美的作品,但是當我嘗試輸出的圖像直接,我得到腳本網址作爲圖像
$draw = new ImagickDraw();
$draw->setFont('AnkeCalligraph.TTF');
$draw->setFontSize(52);
$draw->annotation(110, 110, "Hello World!");
$draw->annotation(50, 220, "Hello World!");
$canvas = new Imagick('./pictures/test_live.PNG');
$canvas->drawImage($draw);
$canvas->setImageFormat('png');
header("Content-Type: image/png");
echo $canvas;
這是使用的代碼。如果我使用writeimage,則創建服務器上的文件時不會出現問題。有沒有人有任何想法我做錯了什麼?
試圖從0創建一個新文件,沒有其他輸出,利用來自手動,在Firefox相同的錯誤,空圖像中的第一實施例其它瀏覽器 – Raz 2010-04-07 11:36:05