BuffaloHELP
Feb 22 2006, 02:12 PM
In search of dynamically changing quote, saying or all other types of text on an image I came across a code that I have modified to fit my initial usage. This procedure requires two files and short knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this procedure very fast. - Code 1: dynamic_sig.php (you can rename this to index.php and you'll see at the end why)
- Code 2: a simple text file named anything (I will call it name.txt)
Code 1CODE <?php header("Content-type: image/png");
$image = imagecreatefrompng("../images/sotw_background.png");
//imagecolorallocate($image, R, G, B) in HEX values $font_black = imagecolorallocate($image, 2, 1, 8); $font_blue = imagecolorallocate($image, 25, 0, 255);
$List = "name.txt"; $string = trim(file_get_contents($List));;
//($image, fontsize, rightindent, downindent, data, txtcolour) imagestring($image, 3, 12, 3, "T17", $font_blue); imagestring($image, 1, 86, 6, "SOTW", $font_black); imagestring($image, 1, 110, 6, $string, $font_black);
imagepng($image); imagedestroy($image);
?> Code 2CODE WINNER - USERNAME For a working demo please refer to #23, #24 and #25 here http://www.trap17.com/forums/index.php?s=&...ndpost&p=222107Let's break it down. As you can see in Code 1 CODE header("Content-type: image/png"); that HEADER calls for PNG as image type. This is crucial since only PNG images can handle dynamically applied text. CODE $image = imagecreatefrompng("../images/sotw_background.png"); states the location of the background image you are going to use. It looks like this  CODE //imagecolorallocate($image, R, G, B) in HEX values $font_black = imagecolorallocate($image, 2, 1, 8); $font_blue = imagecolorallocate($image, 25, 0, 255); as the remark that I made, the value of color in HEX will determine the text color you choose. I made two to make it as a comparison. CODE $List = "name.txt"; $string = trim(file_get_contents($List));; This assigns a SINGLE line characters from file named name.txt. And then assigns to variable name STRING from the opened text file. If you don't want to use external file, you can simply set CODE $string = "your text 1"; $string = "your text 2"; etc. You can even do a random text where CODE $select = rand(1,7); if($select==1)$string = "text 1"; if($select==2)$string = "text 2"; if($select==3)$string = "text 3"; if($select==4)$string = "text 4"; if($select==5)$string = "text 5"; if($select==6)$string = "text 6"; if($select==7)$string = "text 7"; CODE //($image, fontsize, rightindent, downindent, data, txtcolour) imagestring($image, 3, 12, 3, "T17", $font_blue); imagestring($image, 1, 86, 6, "SOTW", $font_black); imagestring($image, 1, 110, 6, $string, $font_black); This is where the magic happens. As you can see the position of the text is determined by second two numbers. The first number determines the font size. Instead of preset characters, i.e. T17 and SOTW, you can have $string1, $string2 etc. The rest is needed to close up the PNG image and safely project reconstructed new image onto the browser. About the sig rotator reference: By renaming dynamic_sig.php to index.php and placing it under a directory called filename.png (yes directory with extension), you can use your newly created dynamic image in the forum CODE [img]http://source_site/filename.png[/img] This will display the dynamic image as though it's been there all along. One key note is that text is only written within the boundary of an image. So if you are looking for larger image simply make your picture larger in dimension. You can have multiple rows and variable font sizes.
Reply
Johnny
Feb 26 2006, 10:19 AM
Great stuff Buffalo, and thanks for the help.
Reply
nehmanator333
Jul 8 2006, 03:40 AM
Yeah, it's very useful.
Reply
electron
Jul 8 2006, 05:01 AM
Hay i have a site dedicated towards this thing. I made this sig generator and people can use it as well. Just register fill in the text and you are done. here is the link: www.esigs.be My sig is also using that.
Reply
peroim
Jul 9 2006, 07:08 PM
this is a great code, i've been looking for something like this everywere. tyvm
Reply
farsiscript
Jul 11 2006, 01:37 PM
thanks dear BuffaloHELP i want write sig maker ( random text , visit ip address and more ) how can i do that ? This is my questions for example do you have GD image soruce or tutorials ? i must user GD image ? thanks
Reply
Regain
Nov 20 2006, 11:04 PM
sendot
Apr 7 2007, 02:38 AM
Great script, but for some reason when I upload it to my ftp and link it to forums it shows up as the dreaded red x. Do you have any ideas why this may be? I can send you my edited PHP file and everything if you need, I just really wanna get this thing working. EDIT: I apologize, but I already fixed the problem. Thanks again for the script.
Reply
Imtay22
Apr 9 2007, 09:55 PM
Wow, I was looking all over for a code like this one! I downloaded one once, but it included over 100 php files. which would take 2 hours to download and upload. Now I found a code that has two files and takes up little space!
Reply
joacorock
Apr 10 2007, 09:16 AM
It's very a nice code, and useful!
Reply
iGuest
Feb 8 2008, 11:35 PM
adding images to images
Dynamic Image / Signature Generator
How would you add an image on top of $image in a specific location? -question by halo2pac
Reply
galexcd
Jan 30 2008, 02:18 AM
QUOTE(FeedBacker @ Jan 26 2008, 11:45 AM)  Is there a way to change the font face?? If you use imagettftext() instead of imagestring() you can specify a certain true type font on your server.
Reply
Recent Queries:--
php dynamic image editing text - 2.18 hr back. (2)
-
text to images signature - 3.04 hr back. (1)
-
dynamic sig for ipb - 11.88 hr back. (1)
-
dynamic png image - 14.41 hr back. (1)
-
php image generator random text - 14.90 hr back. (1)
-
how to change the picture in the signature - 20.67 hr back. (1)
-
dynamic signature php - 30.10 hr back. (1)
-
picture signature from text - 34.31 hr back. (1)
-
html code generator signature - 34.36 hr back. (1)
-
signature generator script - 35.62 hr back. (2)
-
change text style dynamic php - 41.84 hr back. (1)
-
dynamic text with change in address bar - 42.86 hr back. (1)
-
antispam image generation php - 43.02 hr back. (1)
-
php dynamic signatures - 44.67 hr back. (1)
Similar Topics
Keywords : dynamic, image, signature, generator, simple, code, change, text, image
- Create Table - Mysql Code - Help
(1)
Php Source Code Unveiled In Browser?
is that possible? (7) I am quite new to PHP and this concern came to my mind after playing around a bit with it... When
PHP is not correctly configured on the web server the source code of a php file we try to access
through a browser will be shown instead of the result of the code itself. This will normally not
happen when PHP is working properly, but I was just wondering if it could still be possible to see
that code if a user wanted to or if something on the server failed. This would for example expose
sensitive information like mysql passwords and so on... Is anything like that possib....
Malicious Code Injection
(3) Hi everyone! This is my first post, so be kind! Basically, I'm trying to get a free
host together so am writing some posts. Here's a little summin' summin' about malicious
code injection with PHP applications. Basically, this security exploit is one of the oldest tricks
in the books and all comes down to the fact that PHP allows execution of both local and remote
scripts with the SAME function... dur. Anyway, this is how it works. Image you've just employed
a young go getter, straight outta uni, who has found becoming a Jack of all trades a ....
Php And Mysql Programming
anyone knows a code for mysql and php (2) hi everyone! I am making a program using php and mysql...I am a noob on this so i need your
help guys...I want to make a simple program that will some values and then store them on a database
and then retrieve them...uhmm let me give an example out put of what i need. This is the example
say..: Enter First Name: Enter Last Name:
Enter Age: Enter Address: ..those
are the data needed for input values...my question now is how can I make a database....
Image Upload
?!? (11) I need the image upload script which automatically resized the image by specified size and store it
in the specified folder.....
Php Code Needed Iii
(10) Hello, everyone. I need your help again! Who might create the PHP code, the picture is
above this text. Basically, I want when the user fill in all the information in this form, it
automatically was sent to my email. And, then, the dialog box appears or on the same window, it was
said that your request has been sent. Moreover, if the user did not fill the entire information,
the dialog box appears stating that you did not fill some field. Thanks, for help. You always do
that.....
Php Code?
Mathematical Applications (12) Hello, everyone. The help is needed again. How can I make calculator in PHP language? That will act
like that a user just type in the fields known values, then click the button, and it's going to
be solved automatically. In other words, have can I write a formula in PHP, how to plug it inside
that language. For example, the formula to find a peremeter of square is: P=4a. So, a user
just can write the known value which is peremeter itself and it will find the side of a square; and
vice versa. If you can write many things how to do such formulas, such as comp....
Php Code Needed
Working Together? (5) Hello, everyone. I need your help again. This forum is quite good for it. Well, I need create a
registration form for my web-site using PHP and SQL. The information it should contain: 1) User
Name 2) First Name 3) Last Name 4) Password 5) e-mail Address 6) Security Image: that images helps
to protect a random registration, for instance, 56+2=where user have to type an answer in order to
finish registration. That's all for today. Anymore things, I will post another post over here.
....
Php Code
Needed?! (15) Well, I am a novice in PHP programming, so there is a script which I wanna get: 1. You go the
web-site 2. On the main screen, there is a some kind of field windows, the one you get used to type
in, when you go to google, for instance. 3. He or she types her email address and it's going to
be saved in my SQL database. 4. That's it. Help me if you can.....
Use Rss In Php Code
(3) so, how can I make RSS reader on my website? thanks in advance....
Will This Code Work
php linking script ?p= (5) hi i'm not that great at php so i'm not to sure if this will work or not. but what i want to
do is be able to use ?p=staff or what ever page name, with out the php extion, and i would like to
no if this simple script i made would work. the code is: CODE <?php $p =
$_GET['p']; if ( !empty($p) &&
file_exists('./' . $p . '.php') && stristr( $p, '.'
) == False ) { // pages = directory where you store your pages $file = './'
. $p . '....
I Need Some Proof Reading For My Code Please! [resolved]
(7) Well... everything is fine except the Content Select section (refer to the in-code headings)...
thats where it says the error is... could anyone find out why it wont work when I click one of my
links? http://2kart.trap17.com/progress.php for an example of what happens...
//----------------- //portfolio paths //----------------- $portfolio = "/portfolio"; $lay
= "/images"; //------------------ //navigation //------------------ $link = ˇ Home
html; $link = ˇ Portfolio html; $link = ˇ Programming html; $link = ....
Html Code Tester. Online Script
(15) Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
Current script: CODE <?php //Save this as something like htmltest.php function
CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
input $html_safe=str_replace("<?php"," ",$html_unsafe);
//Starts security measures $html_safe=str_replace("?>","
",$html_sa....
Awesome Source Code Viewer Script
(7) Hello! I have just came up with a sweet script to show the source code of any website and it
only requires one file. This is the basis of the script and can be customized with CSS and other
things and can be instituted as a public resource. Well I will provide the code and a step-by-step
tutorial on each of its parts. This code has been tested by me. Enjoy! CODE <?php
//This little tag starts our php script and is easily the most important part of the script. //We
will start our base script here. //You can change some of the styles used here to your des....
Getting An Array Value Of A Dynamic Variable
(9) Ok i can't believe I need help in php but I can't figure this out... If i have an array,
lets say called test, how do i get a certain value from that array when referencing it dynamically
by either a string or another variable? Example: CODE $test=array(1,2,5);
$name="test"; //Doesn't work: echo $$name[0]; /Doesn't
work: echo ${$name}[0]; ....
I Just Wrote A Script For A Php Text Editor!
(8) Yes, I just wrote out a script for a PHP text editing program. It is very basic but I would like to
be able to actually use this and update it. First, I need version 0.7 to be proofread. It will be
upgraded to 0.8 after closed beta, 0.9 after open beta, 1.0 when ready. I would love to have some
people help with this project. Right now it is a simple PHP script and HTML form. Here is the
current script. I would like it to be proofread. $fileName = "$_REQUEST ";
$fHandle = fopen($fileName , 'w') or die("Can't write file."); $fCont....
Php Text Editor
(1) Is there any possible way using XML and PHP that you could create a text editor that can save files
in your documents and also make a hotlink to your site. Much like a online notepad. I would like to
know how I would make on of these and whether or not MySQL or XML would be a good language to use
for storing data. My current idea deals with only PHP and iframes. It really isn't an editor
though, more like a notes page. I would like a way though to be able to create a database with info
stored from the PHP script which and be able to save to your hard drive. Also, i....
Get A Image Indentifier With Gd Library
GD library question (7) Hey fellow coders, I'm having a problem. If you output a im indentifier in php with gd libary.
With this method for example: CODE <?
header("(anti-spam-(anti-spam-(anti-spam-content-type:)))
image/png"); $imgWidth = 50; $imgHeight = 50;
$image=imagecreate($imgWidth, $imgHeight); $colorBlack =
imagecolorallocate($image, 0, 0, 0); // first color you define with colorallocate is
also the color of the background of your image imagepng ($image); image....
Php And Flash Image Gallery
Need some help in creating or editing an xml file while viewing some o (5) Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
picture: CODE <pictures> <image location="nameofpicture1.jpg"
desc="" /> <image location="nameofpicture2.jpg" desc="" /....
Whats Wrong>?
please see this piece of code and see whats wrong: (9) CODE require('connection2.php'); $select=mysql_query("SELECT * from
`users` WHERE password='$_GET[password]'");
$co=mysql_num_rows($select); if ($co = 1) {
session_start(); $s=session_id();
$_SESSION['access']="yes";
$username=$_GET['username'];
header("location:../main/index2.php?a=$_GET[username]&s=$s"
;); //echo "<a href='.&....
Trap17 Board Status Dynamic Image
(13) I was really board a few days ago and decided to make a trap17 board status image for my sig
/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> That is the
current beta. I'm still working on it so that it might display the most recent post or
somthing, i'm not sure. After I finish it ill give out the source code but if you want one
right now you can pm me and ill set one up to get the info on your account ^.^ So I was wondering
how you members liked it? You'll probably think that its a waist of time, but alas as I sai....
How To Make A Random 7 Number Code?
(2) I am making a script in php, and for it I need to know how to make a random 7 digit code. I think it
has something to do with md5, but i am not sure. Thanks! EDIT- Can someone please change the
title to "How to make a random 7 digit code in php?" Thanks!....
Can I Make Dynamic Menu In Php
is it posible to make dynamic menu in php without javascript (7) As there are many java script by which we can have event based interaction like,message on mouse
over etc,that we can create dynamic menu in javascripts to make navigation bar ,but is it possible
in php to have this acomplished without javascripts,i am new to php,is it possible?. Thanks....
Dynamic Php Pages
Nice tutorial (5) This is a really good tutorial on making php pages that normally appear as
www.domainname.com/links.php appear as www.domainname.com/index.php?page=links
http://nuwen.com/tutorials/php-dynamic-pages ....
Wap Source Code Viewer
Mobile/wap source code viewer page (4) This is a source code viewer that will workl on wap/mobile sites but you can easily convert it to
work on web im sure ;-) CODE <? header("Content-Type:
text/vnd.wap.wml"); echo '<?xml version="1.0"
encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <head><meta
http-equiv="Cache-Control" content="no-cache"
forua="true"/></head> <card title="s60.nerds.....
Watermark Your Image With Simple Php Script
found it on the net (35) This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
Scripts site. Just in case the site may not show, I will include the code here: List of things
needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
transparent gif image with the watermark - goes in the same directory as this script // ....
Adapting Html Code Embed To Work On Phpnuke
Help With This Html Code Pls (7) QUOTE how can get this html code to work on my phpnuke site? what tags would i
have to enable in the $Allowable HTML part of my config.php file?? Edited topic title. Moved
to Programming. ....
Change Permission With Php Code
code to change files' and folders' permissions? (3) As everyone know, there two ways (that I can think of) to change files' and directories'
permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
client that supports chmod. Well, I'm doing something for my site that requires files to have
full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
alternative to doing this is to change each file permission myself, but that would be....
Php Clock
source Code (7) Hi Every one i find this code its very easy simple php clock i think you can use it /blink.gif'
border='0' style='vertical-align:middle' alt='blink.gif' /> CODE <? // Binary Clock //
script copyrightŠ 2002 Andreas Tscharnuter // questions? contact: psychodad@psychodad.at ||
[url=http://www.psychodad.at/clock/]http://www.psychodad.at/clock/[/url] //
free to use, copy and modify but leave comments untouched;) // just include this file where
your binary clock should appear // version 1.2 03 September 2003 // below you can ....
How do you test your php code
(77) We know that php is a server side scripting language. So we will need a server with the php parser
to parse/test our code. How are you doing that. Do you upload it to a server for testing or did you
instal php and the server (apache) on your computer (localhost)....
Looking for dynamic, image, signature, generator, simple, code, change, text, image
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for dynamic, image, signature, generator, simple, code, change, text, image
*MORE FROM TRAP17.COM*
|
advertisement
|
|