Image generator? Address bar javascript?

Status
Not open for further replies.

Zacki

Solid State Member
Messages
17
Hello everyone!

IF YOU ARE LAZY JUST READ THE UNDERLINED SENTENCES =D

First of all I hope I chose the right section, because my question is in so many different areas.

Second of all, I know nothing about programming language, but some basic knowledge about files, servers and the web.


Alright, there are two things that I want to accomplish:
1. Update my forum signature image with a hotkey.
2. Update my forum signature text with a hotkey.

It's not like I posted it here right after it came in my mind. I've been googling around for hours now, and learned some stuff and done parts of my work. I need a little help and thought maybe you guys knew a little more than me about this =P

Alright, about #1 here's the plan:
I already have like 10mb space of my own website that I got from my ISP. I wanna use that space to upload pictures and use that as my forum signature. So, my forum sig would be [img]myisp.com/myownspace/forumsig.png[/img] - and that is set, DONE. Then I've created a batch file that automatically uploads/replaces the existing forumsig.png with a new forumsig.png. Perfect so far, except that the image that I want to upload has to be generated by itself... I mean like, I type in a text, my keybinder (AutoHotKey) copies my text, puts a time stamp before my text and then makes a .png image out of it. Is there any software that can generate an image by getting a text input? For example if I type "Hello! test123testicles", and I run the script, it would put a time stamp like: "[17:26]Hello!test123testicles", and then finally make/save it a/(-s) png image (with my own custom settings).

And about #2, here's the idea:
So I want to update/modify my signature text, not a picture this time. What I've done so far is that I've found out to make a script that launches the website (wow, lol :p), and I know how to modify the text in the signature form, it's through some javascript command. But here's the problem, I don't know how to make it push the final 'Modify' button. When I move my mouse over it, it's not like a link where it shows in the lower left side of the browser the url it takes you to. However, I use Google Chrome, and I rightclicked the button itself and clicked on 'Inspect Element', and this is the highlighted line:
<input type="submit" name="profileaction" value="Modify Profile" accesskey="s">
I've tried doing it through the address bar for hours, I don't know how =/. So my question is, how do I make it press that button through the address bar? And also, I use AutoHotKey as my keybind/script. But how do I make a script that first launches the modify signature page, then types in the javascript and then finally clicks the Modify button? If it can be done with a batch file, that would be great too!


I've spent alot of time trying to figure these things out, I can't :( I'd appreciate help from you guys. Sorry if I'm a ******* :p

Thanks a bunch in advance, and sorry for my english.
<3
 
I did this for the Kudos system that we had for the forums before 'reputation' was introduced.

Im busy now, but these two words will get you on your way:

PHP
GDLibrary

With GDlibrary and some PHP knowledge you can do something like:

website.com/sigimage.png?text='This is my sig....'

And it will put the text over an image and create the png when ever needed.
 
Most likely the webspace your ISP gave you isn't going to support PHP. So you either need to find a free host that has PHP and the GD Library, or you're going to need to buy hosting. You don't need batch files or anything, just PHP can do what you want there.

As for the other thing, have a look at Firefox with the GreaseMonkey add-on. You can make scripts to automate stuff such as form submitting, so you might find what you want there.
 
Thanks for the answers.
I googled GD Library and PHP, checked out some tutorials and it seems to be too complicated. I mean, every "beginners" tutorial starts off right with the scripting. Dumb me don't even know where I should type in that text/script... Whatever, I have to keep looking. =P

And for the Greasemonkey, I did the same thing, read some tutorials. This one seems to be easier. I've got into it, I'll probably learn to do it in a few days. But I'm a little worried about if it is able to read stuff from a text file =/ I mean, if I want to update my sig text, it has to be a new text everytime, ofcourse. So what I've done is that I've scripted my AutoHotKey to make a .txt file and type in the string (that I want in my sig) and save it. So it would be awesome if Greasemonkey could read from that .txt file and use that to fill in the sig box/form-thing. Is it possible?
 
I'm not sure if GreaseMonkey can read from files or not. It depends how the plugin was made, I don't use it so I don't know.

But I'm sure with some VB or something you could make something work.

As for the PHP, I can write you a script later to do what you want.
 
I'm not sure if GreaseMonkey can read from files or not. It depends how the plugin was made, I don't use it so I don't know.

But I'm sure with some VB or something you could make something work.

As for the PHP, I can write you a script later to do what you want.

Wow, that is too kind of you! It's nothing too complicated that I want. Just a png image with transparent background, about 30p (height) x 600p (width) and one line of size 32px text on it with the regular font Times New Roman. And I already have a batch file that can upload a .txt file with my signature text in it, so it would be great if it could read the content of that file and write it on the image. OR any other way that works.

Thank you very, very much in advance!!

Edit: It's also perfectly ok if the image is generated on my computer and then manually uploaded. Just anything that can make an image out of text.
 
You will need a webserver with PHP and the GD2 library. For this to work.

Download files here: http://crazedizzled.com/zacki.rar

The files contained are: zacki.php, sig.txt, trans.png, times.ttf

You need to upload all of the files to the same directory on your webserver.

Your batch file needs to be able to produce a text file with contents like this:
Code:
This is the signature text | this is a timestamp

It will only work if it is generated that way. You can get the timestamp with this code:
Code:
@echo off
echo %TIME%

The text file must be named sig.txt

Once a new sig.txt file is uploaded, the image will automatically be changed to display the new signature text.

The image can be displayed like this:

HTML
Code:
<img src="http://your-url.com/zacki.php" />

Forum BBCode
Code:
[ img]http://your-url.com/zacki.php[ /img]
Note: remove spaces on img tags


Okay I think that's everything...let me know if this is what you wanted.
 
Wow! Thank you very much!

I uploaded the files you sent me, then went to the zacki.php, it only shows the script. So maybe my web space doesn't support php =/ Whatever I also signed up for a free x10.bz website, uploaded the files there and again, it only shows the script, even though on their website they say it supports php and GD Library (click).

But thanks any way man, that was kind of you. I guess I have to try some other sites =)
 
I havent downloaded the files but make sure that the script has he proper opening and closing tags: <?php to open and ?> to close. Im sure crazed did that but its a possibilty. Otherthing is make sure its .php and not .php.html. This may have happened when you were looking at the script/editing it and saved.

x10 is a good host and does support php.
 
Then I must be doing something wrong =/
Here it is:
Code:
<?php

// get text file containing signature text and timestamp
$fp = fopen('sig.txt', 'r');
$data = fread($fp, filesize('sig.txt'));
fclose($fp);

// the contents of sig.txt should look like
// signature text | timestamp
// so split that data and create variables
list($text,$time) = explode('|',$data);

// trim whitespace from variables
$text=trim($text);
$time=trim($time);
$hour=trim($hour);
$min =trim($min);

// get hour and minutes from the timestamp
list($hour,$min)  = explode(':',$time);



$time = '[' . $hour . ':' . $min . ']';

// this string will be the final output in the signature
// EDIT: My AHK already puts a timestamp before the text itself.
$str = $text;

// begin creating the image with the GD library
$img = imagecreatefrompng('trans.png');
$new_img = imagecreatetruecolor(600,30);

// assign transparency
$bg = imagecolorallocatealpha($new_img,255,255,255,127);

// assign black text
$black = imagecolorallocate($new_img,0,0,0);

// assign font filename
$font = 'times.ttf';

// create final image
imagefill($new_img,0,0,$bg);
imagecopymerge($new_img,$img,0,0,0,0,600,30,0);

// apply text string to the image
imagettftext($new_img,20,0,0,20,$black,$font,$str);

header('Content-Type: image/png');

// display the image
imagepng($new_img);
imagedestroy($new_img);

?>

And I uploaded this and the other three files from the zip to the same folder.

Edit: Woohooo! It finally works! Thank you guys alot! And special thanks for you Crazed, I really appreciate your help!



Second edit: Unfortunately the forum I'm trying to use it on doesn't support the [img]...zacki.php[/img], lol. =/
 
Status
Not open for further replies.
Back
Top Bottom