首页 \ 问答 \ 安装后运行Image magick代码(Running Image magick code after installation)

安装后运行Image magick代码(Running Image magick code after installation)

我刚刚在我的centos中安装了Imagemagick和imagick

yum install ImageMagick
yum install ImageMagick-devel

cd /root
wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar zxf imagick-3.0.1.tgz
cd imagick-3.0.1
phpize
./configure
make
make install

安装顺利没有任何错误,但现在我试图运行,php ImageMagick代码

<?php  
$cmd = " -background none -pointsize 60 -font DRAGM.ttf -fill red ". 
 " -strokewidth 1 -stroke black label:\"myexample\" "; 

exec("convert $cmd coloured_font.png"); 
?>

编辑:我也试过这段代码......但是它仍然显示一个空白页...

<?php
/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'gray' );

/* New image */
$image->newImage(800, 75, $pixel);

/* Black text */
$draw->setFillColor('black');

/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );

/* Create text */
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');

/* Give image a format */
$image->setImageFormat('png');

/* Output the image with headers */
header('Content-type: image/png');
echo $image;

php.info显示

imagick模块启用imagick模块版本 3.0.1 imagick类 Imagick,ImagickDraw,ImagickPixel,ImagickPixelIterator ImageMagick版本 ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org ImageMagick版权版权所有(C)1999- 2009 ImageMagick Studio LLC ImageMagick发布日期 2012-05-07 ImageMagick支持的格式数量: 198 ImageMagick支持的格式 A,AI,ART,ARW,AVI,AVS,B,BGR,BMP,BMP2,BMP3,BRF,BRG,C, CALS,CAPTION,CIN,CIP,CLIP,CMYK,CMYKA,CR2,CRW,CUR,CUT,DCM,DCR,DCX,DDS,DFONT,DNG,DOT,DPS,DPX,EPDF,EPI,EPS,EPS2,EPS3, EPSF,EPSI,EPT,EPT2,EPT3,ERF,FAX,FITS,FRACTAL,FTS,G,G3,GBR,GIF,GIF87,GRADIENT,GRAY,GRB,HALD,HISTOGRAM,HRZ,HTM,HTML,ICB,ICO, ICON,INFO,INLINE,IPL,ISOBRL,JNG,JP2,JPC,JPEG,JPG,JPX,K,K25,KDC,LABEL,M,M2V,M4V,MAP,MAT,MATTE,MIFF,MNG,MONO,MOV, MP4,MPC,MPEG,MPG,MRW,MSL,MSVG,MTV,MVG,NEF,NULL,O,ORF,OTB,OTF,PAL,PALM,PAM,PATTERN,PBM,PCD,PCDS,PC L,PCT,PCX,PDB,PDF,PDFA,PEF,PFA,PFB,PFM,PGM,PGX,PICON,PICT,PIX,PJPEG,PLASMA,PNG,PNG24,PNG32,PNG8,PNM,PPM,PREVIEW,PS, PS2,PS3,PSD,PTIF,PWP,R,RADIAL-GRADIENT,RAF,RAS,RBG,RGB,RGBA,RGBO,RLA,RLE,SCR,SCT,SFW,SGI,SHTML,SR2,SRF,STEGANO,SUN, SVG,SVGZ,TEXT,TGA,THUMBNAIL,TIFF,TIFF64,TILE,TIM,TTC,TTF,TXT,UBRL,UIL,UYVY,VDA,VICAR,VID,VIFF,VST,WBMP,WMF,WMV,WMZ,WPG, X,X3F,XBM,XC,XCF,XPM,XPS,XV,XWD,Y,YCbCr,YCbCrA,YUV

理想情况下,它应该使用文本myexample创建图像,但它不起作用,有没有办法解决这个问题?


I have just installed Imagemagick and imagick in my centos .using

yum install ImageMagick
yum install ImageMagick-devel

cd /root
wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar zxf imagick-3.0.1.tgz
cd imagick-3.0.1
phpize
./configure
make
make install

Installation went fine without any errors , but now iam trying to run, php ImageMagick code

<?php  
$cmd = " -background none -pointsize 60 -font DRAGM.ttf -fill red ". 
 " -strokewidth 1 -stroke black label:\"myexample\" "; 

exec("convert $cmd coloured_font.png"); 
?>

Edit: I have also tried this code... but still it's displaying a blank page...

<?php
/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'gray' );

/* New image */
$image->newImage(800, 75, $pixel);

/* Black text */
$draw->setFillColor('black');

/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );

/* Create text */
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');

/* Give image a format */
$image->setImageFormat('png');

/* Output the image with headers */
header('Content-type: image/png');
echo $image;

php.info shows

imagick module enabled imagick module version 3.0.1 imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator ImageMagick version ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org ImageMagick copyright Copyright (C) 1999-2009 ImageMagick Studio LLC ImageMagick release date 2012-05-07 ImageMagick number of supported formats: 198 ImageMagick supported formats A, AI, ART, ARW, AVI, AVS, B, BGR, BMP, BMP2, BMP3, BRF, BRG, C, CALS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DNG, DOT, DPS, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FITS, FRACTAL, FTS, G, G3, GBR, GIF, GIF87, GRADIENT, GRAY, GRB, HALD, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RBG, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV

ideally it should create image with the text myexample, but its not working, is there any ways to fix this?


原文:https://stackoverflow.com/questions/15544582
更新时间:2023-07-17 16:07

最满意答案

示例模块包含许多开始使用的示例,包括电子邮件。 在这里看到它在api网站查看drupal_mail()函数来查看函数参数和用户示例以及函数的使用。

GIYF。


Examples module contains number of examples to get started with, including emails. see it in api site here See drupal_mail() function to see function params and user examples as well as function use.

GIYF.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)