• 0

Dynamic Signatures


Question

How would I make a signature that allows users to put a piece of text into my signature? I know you can use PHP, but I don't have the slightest clue about PHP

(Apart from Cutenews stuff)

Could someone make me a saple signature, very plain, and show me how to allow users to imput text into it thru my website?

Edited by TimRogers
Link to comment
https://www.neowin.net/forum/topic/301987-dynamic-signatures/
Share on other sites

Recommended Posts

  • 0

Hey,

I just went through a whole learning process about this.

The result are my two signature images.

One conjurs up data output by an iTunes plugin, and the other is a random quotes.

I will post the sourece for the latter:

<?php

// tell the user's browser that it is an image
header("Content-type: image/png");

// load the background
$image = imagecreatefrompng("quote.png");

// define the color black (the colour of the text)
$clr_black = imagecolorallocate($image, 0, 0, 0);
$clr_white = imagecolorallocate($image, 255, 255, 255);

// Now let's add the text

// define the font, x_position
// how much the y_position changes (increments)
$line_number = 1;

//Get a random number
$num = rand(1,3);

//Start the switch function
switch ($num) {
//First Quote
case 1:
$quote = "Nothing strengthens authority so much as silence.";
$author = "Leonardo Da Vinci";
break;
//Second Quote
case 2:
$quote = "My life is one long curve, full of turning points.";
$author = "Pierre Elliott Trudeau";
break;
case 3:
$quote = "It\'s amazing what you can accomplish if you do not care who gets the credit. This is a test";
$author = "Leonardo Da Vinci";
break;
}
//Add text to image (img, size, angle, x,y, colour, .ttf, text)
ImageTTFText($image, 8, 0, 10, 50, $clr_black, "verdanai.TTF", stripslashes($author));
ImageTTFText($image, 9, 0, 10, 15, $clr_black, "verdana.TTF", wordwrap(stripslashes($quote), 80));

// and now... we display the image
imagepng($image);
imagedestroy($image);
?>

If your understanding PHP is average, you should be able to pick this apart, and use what you need.

If you need more detailed instructions on how to use this, reply accordingly and I will post a description of the script.

-Ax

  • 0

Try these:

Random Banner:

<script LANGUAGE="Javascript"><!--

// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************

function banner() {
};

banner = new banner();
number = 0;

// bannerArray
banner[number++] = "<a href='http://www.url1.com' target='_blank'><img src='images/banner-1.gif' border='0'></a>"
banner[number++] = "<a href='http://www.url2.com' target='_blank'><img src='images/banner-2.gif' border='0'></a>"
banner[number++] = "<a href='http://www.url3.com' target='_blank'><img src='images/banner-3.gif' border='0'></a>"
banner[number++] = "<a href='http://www.url4.com' target='_blank'><img src='images/banner-4.gif' border='0'></a>"
banner[number++] = "<a href='http://www.url5.com' target='_blank'><img src='images/banner-5.gif' border='0'></a>"
// keep adding items here...

increment = Math.floor(Math.random() * number);

document.write(banner[increment]);

//--></SCRIPT>

Random Avatar:

<?php
header('Content-type: image/jpeg');

//URL of the folder where the avatar images are
//The avatar images and php file can be in different places
$url = "http://homepage.ntlworld.com/frank.cox/damon/images/avatars/";

//List of filenames you wish to randomize, currently only jpegs are supported
//Note the last filename does not need a comma after it
$avatar = array (
"phpone.jpg",
"phptwo.jpg",
"phpthree.jpg"
);

//Select a random image from the list
$size = (count($avatar) - 1);
if (!isset($id) || ($size < 0) || ($id > $size)) {
$id = rand (0, ($size - 1));
}

//Output the image
$img = imagecreatefromjpeg($url . $avatar[$id]);
imagejpeg($img);
imagedestroy($img);
?> 

For that, you might want to try Tim Dorr: http://home.timdorr.com/scripts/sig/

If you get the script for that - see if you can post it here?

Hope they help,

Pete

  • 0

It's pretty easy :-

1. Make a page with a form, a textbox and a button on. Make this script submit to something like action.php

2. In action.php make it check to see if something was entered (also badwords, if you feel so inclined). If everything checks out allright then write the text to a .txt file.

3. In your image script use file_get_contents to get the data from inside the textfile and load it to a variable. Write this variable to the image using imagettftext or whatever you're using.

Done !

  • 0

Alright, I'll take a couple mins to fire this one out!

1. We'll be using two files for this. form.html and genimg.php (generate image).

form.html will simply have the form that a user can fill out to have the image display.

genimg.php will then take that information and using it to build the image you want!

Here's the form you can put on your site:

<form action="genimg.php" method="post" name="genimg">
<input type="text" name="text"><br>
<input type="submit" value="Make Image!">
</form>

And here's GenImg.php

<?php

if(isset($_POST['text'])) {
	//generate image
	header("Content-type: image/png");

	$image = imagecreatefrompng("image.png");

	//Colour Black
	$clr_black = imagecolorallocate($image, 0, 0, 0);

	//Add the text! REMEMBER TO ADJUST the number 90 at the end of this line for the length of your image.
	//Simply keep changing it till it works well for your site. (It makes the text not spill off the image).
	ImageTTFText($image, 9, 0, 5, 14, $clr_black, "arial.TTF", wordwrap(stripslashes($_POST['text']), 90));

	imagepng($image);
	imagedestroy($image);
} else {
	?>
	Sorry, you forgot to fill out the form!<br>
	<form action="genimg.php" method="post" name="genimg">
	<input type="text" name="text"><br>
	<input type="submit" value="Make Image!">
	</form>
	<?php

}
?>

This is a VERY basic code. I thought making it complicated would just confuse you :p.

You'll also need to put arial.TTF in the same directory as this file (You can find this file in: C:\Windows\Fonts\) and you'll also need an existing image named image.png.

The command:

ImageTTFText($image, 9, 0, 5, 14, $clr_black, "arial.TTF", wordwrap(stripslashes($_POST['text']), 90));

Has to be modified to make the text fit where you want it on your image. you can do this by adjusting the numbers 5 and 14. 5 sets the VERTICAL adjustment (up and down) and 14 adjusts the HORIZONTAL adjustment (LEFT and RIGHT). the number 9 is the font size, and the 0 is the angle.

I'd be glad to answer any questions.

EDIT**

Crud, I just relized you are wanting something a little different... You want people on your site to be able to Adjust YOUR signature image. Never mind this script then, it's not what you're looking for...

-Ax

  • 0

Ok, sorry totally forgot about this thread :rolleyes: ..

This is all in one block, this is the really old one..

<?php

/* Kings mooodi's PHP-GD powered Signature for use on forums
Orginaly made for my personal use on http://forums.ithium.net
Hope you enjoy : simple config bellow easy, simple, clear and commented.
note: thread name is currently supported by IPB only.

Now heres the crappy part:
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


*/

$commentfile = "comments.dat"; //Must be Chmod'd 777
$thisfile = "neowin.jpg"; //this file

//End of Config

if($go == "") {

header ("Content-type: image/png");


// Various Color and image creation Stuff
$im = imagecreate(400, 130);    	// Create Image
$white = imagecolorallocate ($im, 255, 255, 255); // Colours 
$black = imagecolorallocate ($im, 0, 0, 0);
$grey = imagecolorallocate ($im, 226, 215, 215);
imagerectangle ($im, 1, 1, 399, 129, $black);  // Border

//Find and read the comment
$commentopen = fopen($commentfile, "r"); //Open file
$comments = fread($commentopen, filesize($commentfile)); // Read file
$showcomments = explode(":", $comments); //separate comments
fclose($commentopen); //clost file

// Final stage, Print everything on to the image

imagettftext($im, 10, 0, 5, 25, $black, "./trebuc.ttf",  '-> IP : ' .$strIP);                    // Viewer IP
imagettftext($im, 10, 0, 5, 40, $black, "./trebuc.ttf",  '-> Date : ' .$strTIME);           // Date
imagettftext($im, 10, 0, 5, 55, $black, "./trebuc.ttf",  '-> Uptime : ' .$strUP);           // Server Uptime
imagettftext($im, 10, 0, 5, 70, $black, "./trebuc.ttf",  '-> Exec. in : ' .$strGEN);       // Generated in...     
imagettftext($im, 10, 0, 5, 85, $black, "./trebuc.ttf",  '-> Script Update: ' .$strMOD);   // Modified time
imagettftext($im, 10, 0, 20, 115, $black,"./trebuc.ttf",  '' .$showcomments[0]);           // Quote

imagettftext($im, 25, 0, 287, 32, $black, "./bord.ttf",  "mooodi");    // Name
imagestring ($im, 1, 375, 120,  ''.$strVER, $black);                       // Print Script Version


imagepng ($im);
imagedestroy ($im);


}elseif($go == "change") {
//Add comments..//
echo "<body><center>";
echo "<h1>Change Comment</h1>";
echo "<form action=$thisfile><input type=hidden name=go value=gochange>";
echo "New message: <input type=text name=newcomment maxlength=150><br>";
echo "<input type=submit value=\"Update commentwall\">";
echo "<br><br><a href=?go=list>Show Archives</a>";
echo "</center></form></html>";
} elseif($go == "list") {
if(!$commentflag) { $commentflag = "a"; }
// You can edit the archives page here. //
echo "<body><center>";
echo "<table width=70%>";
$commentopen = fopen($commentfile, "r");
$comments = fread($commentopen, filesize($commentfile));
$showcomments = explode(":", $comments);
foreach($showcomments as $s) {
	if($commentflag == "a") {
  echo "<tr><td bgcolor=#F1F3E5>";
  echo "$s<br>";
  echo "</td></tr>";
  $commentflag = "b";
	} elseif($commentflag == "b") {
  echo "<tr><td bgcolor=lightgrey>";
  echo "$s<br>";
  echo "</td></tr>";
  $commentflag = "a";
}
}
fclose($commentopen);
echo "</table></body></html>";
} elseif($go == "gochange") {
if(!$newcomment) {
echo "no comment";
die();
} else {
$newcomment = str_replace("<", "[html] ", $newcomment);
$newcomment = str_replace(">", " [!html]", $newcomment);
$newcomment = str_replace(":", " - ", $newcomment);

$newcommentz = stripslashes("$newcomment");
$commentopen = fopen($commentfile, "r");
$rottencomments = fread($commentopen, filesize($commentfile));
fclose($commentopen);
$commentwrite = fopen($commentfile, "w+");
	if(!fwrite($commentwrite, "$newcommentz:$rottencomments"))
	{ echo "File Write error"; }	
	fclose($commentwrite);
	echo "Comment added, done.";
}
} else {
echo "crap! invalid page...";
die();
}

?>

Notes:

Don't just copy paste the whole thing because its more than likely that you don't have fonts named trhe way I named them.

Make sure you have comments.dat (or whatever you specified your comments file to be) chomd'd to 777.

This is quite old so it is'nt the neatest work ever, and the pages are NOT what my usual stuff looks like.

The code above isn't the whole thing I cut out as much as possible (whilst keeping it error free) so that the comment thing is as clear as possible.

Pages :

filename.ext?go=list : will show all the comments.

filename.ext?go=change : will bring up the add comment change.

Preview :

This is what the above code should output.

neowin.jpg

Test: Add Comment and Archives.

Hope this is what you wanted ;) and umm sorry for the delay.. :rofl: ,

mooodi

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • One of Logitech's best productivity mice is now available for just $79.99 by Taras Buria The MX Master 3S, formerly Logitech's flagship productivity mouse, is now available at an all-time low price during Prime Day sale. Thanks to the latest discount, you can have this mouse for as little as $79.99. This large-sized mouse has many things to like. From its ergonomic shape to the iconic MagScroll wheel, the MX Master 3S is a great productivity-focused accessory. It has an 8K DPI sensor that tracks on various surfaces, including glass. Its main MagScroll has two modes: ratched and infinite, with the latter capable of scrolling up to 1,000 lines in just a second. Additionally, there is a secondary wheel for horizontal scrolling. The MX Master 3S has plenty of buttons, which can be remapped to gestures, keyboard shortcuts, or other actions in the Options+ app on Windows and macOS. You can connect the mouse to up to three devices (via Bluetooth or the Bolt connector) and switch between them with a dedicated button. You also get a USB Type-A to Type-C cable to recharge the built-in battery, which lasts up to 70 days on a full charge, and a quick one-minute charge gets you three hours of use. Logitech MX Master 3S - $79.99 | 20% off for Prime Members Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
    • Exactly, this is just the beginning. I hope that by that time, our inept politicians devise something like a Universal Basic Income, because unemployment and poverty rates will skyrocket otherwise. And believe me, robots that perform physical work aren't a matter of IF, but WHEN. No career is truly safe from AI/robots, it's just a matter of time.
    • Subtitle Edit 5.0.0 by Razvan Serea Subtitle Edit is a powerful, free, and user-friendly subtitle editing tool designed for creating, editing, and converting subtitles for videos. It supports a wide range of subtitle formats, including SRT, ****, and SUB, allowing users to easily modify and adjust subtitles for accurate timing and formatting. With its intuitive interface, Subtitle Edit provides a variety of features such as waveform audio display, spell-check, subtitle synchronization, and real-time video preview, making it an ideal choice for both beginners and professionals. The software also includes powerful tools for batch processing, translating subtitles, and converting between different subtitle formats. Subtitle Edit features: Create/adjust/sync/translate subtitle lines Convert between SubRib, MicroDVD, Advanced Sub Station Alpha, Sub Station Alpha, D-Cinema, SAMI, youtube sbv, and many more (300+ different formats!) Cool audio visualizer control - can display wave form and/or spectrogram Video player uses mpv, DirectShow, or VLC media player Visually sync/adjust a subtitle (start/end position and speed) Audio to text (speech recognition) via Whisper or Vosk/Kaldi Auto Translation via Google translate Rip subtitles from a (decrypted) dvd Import and OCR VobSub sub/idx binary subtitles Import and OCR Blu-ray .sup files - bd sup reading is based on Java code from BDSup2Sub Can open subtitles embedded inside Matroska files Can open subtitles (text, closed captions, VobSub) embedded inside mp4/mv4 files Can open/OCR XSub subtitles embedded inside divx/avi files Can open/OCR DVB and teletext subtitles embedded inside .ts/.m2ts (Transport Stream) files Can open/OCR Blu-ray subtitles embedded inside .m2ts (Transport Stream) files Merge/split subtitles Adjust display time Fix common errors wizard....and more. Subtitle Edit 5.0.0 changelog: Subtitle Edit 5 is a major new release and a big step for the project. For the first time, Subtitle Edit runs natively on Windows, macOS, and Linux from a single, modern, cross-platform codebase. The builds are self-contained, so no separate .NET installation is required, and on macOS and Linux the needed media components (mpv/ffmpeg) are bundled in. Please read before upgrading: Subtitle Edit 5 is a new application, not just an update of Subtitle Edit 4. It has been rebuilt from the ground up to be cross-platform, so: It is not 100% the same app. The look, layout, and some workflows have changed. Some things are in different places, and a few behave differently than in SE4. Not every SE4 feature exists in SE5 yet. SE5 covers all the core editing, conversion, sync, video playback, OCR, and online services, but some of the more specialized SE4 tools are not available yet. Features will continue to be added. If you rely on a specific SE4 feature that is missing, please keep SE4 installed alongside SE5. The easiest way to run both side by side is to use the Portable versions of SE4 and SE5, which keep their settings separate and do not interfere with each other. Which version should I use? Subtitle Edit 5: recommended for most users on Windows 10 (22H2) or newer, macOS 12+, and Linux. Subtitle Edit 4: please continue to use SE4 if you are on an older Windows version (Windows 7/8), or on older / slower computers where SE5 may not run well. SE4 remains available and is the right choice in those cases. To run SE4 and SE5 at the same time, use the Portable versions - you can try SE5 while keeping SE4 as a fallback. Download: Subtitle Edit 5.0.0 | ARM64 | ~60.0 MB (Open Source) Download: Subtitle Edit Portable | 103.0 MB View: Subtitle Edit Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Google Pixel 11 series: Here's what to expect by Hamid Ganji Google Pixel 10 series In recent years, Google has successfully turned its Pixel devices into worthy contenders in the smartphone market. The search giant is now preparing to launch the Pixel 11 series in just a few months, and many Pixel fans are likely wondering what Google has in store for them this year. The next lineup of Google smartphones includes four devices: the Pixel 11, Pixel 11 Pro, Pixel 11 Pro XL, and Pixel 11 Pro Fold. This year, we don’t expect Google to bring revolutionary upgrades to its handsets, and the Pixel 11 series is likely to receive modest hardware improvements alongside a slew of AI-powered features. Here are the rumored specifications of the Google Pixel 11 series ahead of its official debut: When will the new Pixel phones be unveiled? The last two generations of Google Pixel phones (Pixel 9 series and Pixel 10 series) were launched in August, unlike the previous three generations that debuted in October. With that in mind, we expect Google to unveil the Pixel 11 series sometime in August 2026. The exact launch date has yet to be confirmed. Google Pixel 11 CAD renders - Image via AndroidHeadlines How much will the Pixel 11 series cost? Predicting the final price of upcoming smartphones has become increasingly difficult. As you may know, RAM and memory prices are rising sharply, leading to significant increases in the cost of consumer electronics. Recently, Apple CEO Tim Cook said that price increases for some future Apple products are unavoidable, suggesting that the iPhone 18 series could become more expensive. Google has remained tight-lipped about any potential price increases for the Pixel 11 series. If the company manages to maintain last year’s pricing structure, here’s what the lineup could cost: Pixel 11: $799 Pixel 11 Pro: $999 Pixel 11 Pro XL: $1,199 Pixel 11 Pro Fold: $1,799 Given current market conditions, it may be difficult for Google to avoid raising prices unless it adopts cost-saving measures, such as equipping the base model with 8GB of RAM. Google Pixel 11 series anticipated specs: We expect the Google Pixel 11 series to debut with a new Tensor G6 processor as well as an upgraded camera system. The overall design, however, is expected to remain largely unchanged across the lineup. Specifications Pixel 11 Pixel 11 Pro Pixel 11 Pro XL Pixel 11 Pro Fold Display 6.3-inch LTPO AMOLED / 120Hz refresh rate / up to 3100 nits of brightness 6.3-inch Super Actua LTPO OLED, 120Hz refresh rate, up to 3600 nits of brightness 6.8-inch Super Actua LTPO OLED, 120Hz refresh rate, up to 3600 nits of brightness 8-inch inner screen and 6.4-inch outer display, 120Hz refresh rate, up to 3600 nits of brightness RAM & Processor Tensor G6 / 8-12GB of RAM Tensor G6 / 12-16GB of RAM Tensor G6 / 12-16GB of RAM Tensor G6 / 16GB of RAM Storage options 128GB or 256GB 256GB, 512GB, 1TB 256GB, 512GB, 1TB 256GB, 512GB, 1TB Camera 50MP main sensor, 13MP ultra-wide, 10.8MP 5x telephoto, 10.5MP front camera 50MP main camera, 48MP ultra-wide, 48MP telephoto with 5x optical zoom, 42MP selfie camera 50MP main camera, 48MP ultra-wide, 48MP telephoto with 5x optical zoom, 42MP selfie camera 50MP main camera, 10.5MP ultra-wide camera, 10.8MP telephoto camera, 10MP front camera, 10MP inner camera Battery 4,840 mAh 4,707 mAh 5,000 mAh 4,658 mAh Software Android 17 Android 17 Android 17 Android 17 The Pixel 11 series won’t be a major departure from its predecessor, with Google instead focusing on subtle improvements and AI additions such as Gemini Intelligence. However, a patent filed by Google suggests the company is working on a removable battery for its smartphones, and we could see this feature make its way to the Pixel 11 Pro Fold. Given that nearly all smartphones today lack removable batteries, such a feature would be a welcome addition to future Pixel devices. That said, it may not arrive with this year’s lineup after all, and the final decision is yet to be made by Google. The Pixel 11 series could also face an uphill battle in the market. In the Android segment, Samsung is performing well with the Galaxy S26 series, while the Galaxy Z Fold 8 lineup is also expected to launch next month. On the other hand, Apple is preparing to unveil the iPhone 18 Pro and iPhone 18 Pro Max in September alongside its first foldable iPhone.
  • Recent Achievements

    • One Month Later
      timbobit earned a badge
      One Month Later
    • One Month Later
      nates earned a badge
      One Month Later
    • Week One Done
      Almohandis earned a badge
      Week One Done
    • Rookie
      dorf went up a rank
      Rookie
    • First Post
      mike_rumble earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      477
    2. 2
      +Edouard
      171
    3. 3
      PsYcHoKiLLa
      105
    4. 4
      Michael Scrip
      88
    5. 5
      Steven P.
      70
  • Tell a friend

    Love Neowin? Tell a friend!