-
大小: 574KB文件類型: .gz金幣: 1下載: 1 次發布日期: 2021-05-09
- 語言: PHP
- 標簽: gd-2.0.33.ta??gd??
資源簡介
安裝php5必不可少的工具
# tar -zvxf gd-2.0.33.tar.gz
# mkdir -p /usr/local/gd2
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/--with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/--with-freetype=/usr/local/freetype/
# make && make install
代碼片段和文件信息
#ifdef?HAVE_CONFIG_H
#include?“config.h“
#endif
#include?
#include?
#include?
#include?“gd.h“
/*?A?neat?little?utility?which?adds?freetype?text?to
existing?JPEG?images.?Type?annotate?-h?for?instructions.?
Thanks?to?Joel?Dubiner?for?supporting?this?work.?-TBB?*/
enum
{
??left?center?right
};
int
main?(int?argc?char?*argv[])
{
#ifndef?HAVE_LIBFREETYPE
??/*?2.0.12?*/
??fprintf?(stderr?“annotate?is?not?useful?without?freetype.\n“
???“Install?freetype?then?‘./configure;?make?clean;?make?install‘\n“
???“the?gd?library?again.\n“);
??return?1;
#else
??gdImagePtr?im;
??char?*iin?*iout;
??FILE?*in?*out;
??char?s[1024];
??int?bounds[8];
??int?lines?=?1;
??int?color?=?gdTrueColor?(0?0?0);
??char?font[1024];
??int?size?=?12;
??int?align?=?left;
??int?x?=?0?y?=?0;
??char?*fontError;
??strcpy?(font?“times“);
??if?(argc?!=?3)
????{
??????fprintf?(stderr?“Usage:?annotate?imagein.jpg?imageout.jpg\n\n“);
??????fprintf?(stderr?“Standard?input?should?consist?of\n“);
??????fprintf?(stderr?“lines?in?the?following?formats:\n“);
??????fprintf?(stderr?“color?r?g?b?(0-255?each)?[a?(0-127?0?is?opaque)]\n“);
??????fprintf?(stderr?“font?fontname\n“);
??????fprintf?(stderr?“size?pointsize\n“);
??????fprintf?(stderr?“align?(left|right|center)\n“);
??????fprintf?(stderr?“move?x?y\n“);
??????fprintf?(stderr?“text?actual-output-text\n\n“);
??????fprintf?(stderr
???????“If?the?file?‘paris.ttf‘?exists?in?/usr/share/fonts/truetype?or?in?a\n“);
??????fprintf?(stderr
???????“location?specified?in?the?GDFONTPATH?environment?variable?‘font?paris‘?is\n“);
??????fprintf?(stderr
???????“sufficient.?You?may?also?specify?the?full?rooted?path?of?a?font?file.\n“);
??????exit?(1);
????}
??iin?=?argv[1];
??iout?=?argv[2];
??in?=?fopen?(iin?“rb“);
??if?(!in)
????{
??????fprintf?(stderr?“Couldn‘t?open?%s\n“?iin);
??????exit?(2);
????}
#ifdef?HAVE_LIBJPEG
??im?=?gdImageCreateFromJpeg?(in);
#else
??fprintf?(stderr?“No?JPEG?library?support?available.\n“);
#endif
??fclose?(in);
??if?(!im)
????{
??????fprintf?(stderr?“%s?did?not?load?properly\n“?iin);
??????exit?(3);
????}
??while?(fgets?(s?sizeof?(s)?stdin))
????{
??????char?*st;
??????char?*text;
??????st?=?strtok?(s?“?\t\r\n“);
??????if?(!st)
{
??/*?Be?nice?about?blank?lines?*/
??continue;
}
??????if?(!strcmp?(st?“font“))
{
??char?*st?=?strtok?(0?“?\t\r\n“);
??if?(!st)
????{
??????goto?badLine;
????}
??strcpy?(font?st);
}
??????else?if?(!strcmp?(st?“align“))
{
??char?*st?=?strtok?(0?“?\t\r\n“);
??if?(!st)
????{
??????goto?badLine;
????}
??if?(!strcmp?(st?“left“))
????{
??????align?=?0;
????}
??else?if?(!strcmp?(st?“center“))
????{
??????align?=?1;
????}
??else?if?(!strcmp?(st?“right“))
????{
??????align?=?2;
????}
}
??????else?if?(!strcmp?(st?“size“))
{
??char?*st?=?strtok?(0?“?\t\r\n“);
??if?(!st)
????{
??????goto?badLine;
????}
??size?=?atoi?(st);
}
??????else?if?(!strcmp?(st?“color“))
{
??char?*st?=?strtok?(0?“\r\n“);
??
- 上一篇:史上最強最全的微信大轉盤,刮刮卡代碼程序控制中獎概率
- 下一篇:php簡單某排班源碼
評論
共有 條評論