{"id":1356,"date":"2018-01-19T19:22:44","date_gmt":"2018-01-19T19:22:44","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/image-creation-with-php-page-2\/"},"modified":"2018-01-19T19:24:43","modified_gmt":"2018-01-19T19:24:43","slug":"image-creation-with-php-page-2","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/image-creation-with-php-page-2\/","title":{"rendered":"Image Creation With PHP Page 2"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Rasmus Lerdorf<\/div>\n<div class=\"\">on July 30, 2000<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<div class=\"articlePara\">\nThe above script would be called with a tag like this from a page:<br \/>\n<tt>&lt;IMG SRC=\"button.php3?s=36&amp;text=PHP+is+Cool\"&gt;<\/tt><\/div>\n<div class=\"articlePara\">\nAnd it looks like this: <img decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/rasmus-php-is-cool.gif\" alt=\"Php is cool\" align=\"top\"\/>.<\/div>\n<div class=\"articlePara\">\nThe &#8216;s&#8217; argument sets the font size and the button auto-scales itself to match. <\/div>\n<div class=\"articlePara\">\nHere it is again with s=18:<br \/>\n<img decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/rasmus-php-is-cool-small.gif\" alt=\"PHP is cool in small text\" align=\"top\"\/><\/div>\n<div class=\"articlePara\">\nNote that I draw first a black rectangle and then a white rectangle slightly offset to create<br \/>\na 3D look.  This might be a little hard to see on a light background, but you would adjust your<br \/>\ncolours appropriately.  And then I do the same with the actual font.  I first draw a black version<br \/>\nand then slightly offset draw a white version of the string on top.  You can of course play around with<br \/>\nthe spacing and colours to get the exact effect you want.<\/div>\n<div class=\"articlePara\">\nOk, so how can you do this on your site?  You need to make sure that your PHP setup has both GD and TTF<br \/>\nsupport.  See the <a href=\"http:\/\/www.php.net\/FAQ.php3#2.3\" target=\"_blank\">PHP FAQ<\/a> for links to these libraries.  It can be<br \/>\na little tricky getting both GD and TTF support compiled into PHP.  I suggest copying libgd.a to \/usr\/local\/lib<br \/>\nand the gd*.h files to \/usr\/local\/include and just do a standard &#8216;make install&#8217; for the FreeTTF library which<br \/>\nshould stick the appropriate files under \/usr\/local\/lib and \/usr\/local\/include.  If you are on Solaris and using<br \/>\nthe shared library version of libttf, then you may see an error when you build Apache that says that it can&#8217;t<br \/>\nfind libttf.so.  If this is the case, edit the src\/modules\/php3\/libphp3.module file and just before the &#8220;-lttf&#8221;<br \/>\nadd -R\/usr\/local\/lib -L\/usr\/local\/lib.  Make sure you do a &#8216;make clean&#8217; before trying to rebuild Apache and things<br \/>\nshould work ok.\n<\/div>\n<div class=\"articlePara\">\n<img decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/rasmus-tree-small.gif\" alt=\"Y as a tree\" align=\"bottom\"\/>ou can do some very neat things with this.<br \/>\n<img decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/rasmus-tree-large.gif\" align=\"bottom\" alt=\"T as a tree\"\/>his one<br \/>\nis just a variation on the above script where I draw a single black letter on a white background.  The font itself is<br \/>\ncalled &#8220;Riot Act&#8221; and I found it on<br \/>\n<a href=\"http:\/\/rover.wiesbaden.netsurf.de\/~kikita\/\" target=\"_blank\">http:\/\/rover.wiesbaden.netsurf.de\/~kikita\/<\/a>.  You can use just<br \/>\nabout any TTF font.  If you have a Windows box sitting around, you can &#8220;borrow&#8221; any of the .TTF files<br \/>\nin your Windows font directory, or look around on the Net on sites like the one above and download some.  Have fun<br \/>\nwith it and if you do interesting things with it, let people here know.<\/div>\n<div class=\"articlePara\">\n&#8211;Rasmus\n<\/div>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"rasmus19990124.html\">\u00ab Previous Page<\/a><\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"rasmus19990124.html\">1<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">2<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>By Rasmus Lerdorf on July 30, 2000 The above script would be called with a tag like this from a page: &lt;IMG SRC=&#8221;button.php3?s=36&amp;text=PHP+is+Cool&#8221;&gt; And it looks like this: . The &#8216;s&#8217; argument sets the font size and the button auto-scales itself to match. Here it is again with s=18: Note&#8230; <a href=\"https:\/\/phpbuilder.com\/image-creation-with-php-page-2\/\" class=\"readmore\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1356","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1356"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1356\/revisions"}],"predecessor-version":[{"id":2181,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1356\/revisions\/2181"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}