Dynamic Sig Help

  • 5 Replies
  • 3134 Views
Dynamic Sig Help
« on: June 28, 2009, 19:49:50 »
Not sure this belongs here, or anywhere on this forum, but I thought I'd give it a try:

Basically, I'd like a php script that, when accessed, takes a random line of text from (say) quotes.txt and writes it on an image (say, userbar.png). There are many similar scripts, doing things such as serving up a random image or showing random bits of text, but none that do exactly this, and I cannot do it myself due to having php.skills = 0.

Just wondering if anyone knows such a script (or is very bored and can  write one :P)

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: Dynamic Sig Help
« Reply #1 on: June 28, 2009, 19:54:03 »
My first question is, do you have a webhosting that runs apache? If not, then you can stop right there.

This is a requirement, because you have to create a dir and let apache threat .png files as php files and parse it. Then you can write a .png file (or .gif or .jpg) generation script and do it for you.

I've done this with the dynamic archievements.

Its really not that hard to write this, but aside of some reference I can point you to, you'll have to dive into it yourself. I can assist in small questions, but not write the entire script for you. (no time)
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

Re: Dynamic Sig Help
« Reply #2 on: June 28, 2009, 20:03:00 »
I have 110mb hosting, it runs Apache but you can't do .htaccess stuff so that may be a problem.

I also have accounts on a few other free hosts and I think some of them let you do that so I'd probably be okay hosting-wise.

Most I've ever done in php was something along the lines of 'echo "you reached this page yay"' or somesuch, and I've pretty much forgotten even that...

Maybe I could take a 'read random text' and 'write text to image' scripts and mangle them both together in an incoherent mess that works mostly by magic, but knowing me it would probably write 9,999 png files to root and crash the server :P 9_9

Soo... yeah. Thanks for the advice though :)

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: Dynamic Sig Help
« Reply #3 on: June 28, 2009, 21:08:05 »
Unless you actually use fopen to write an image, it will most definatelly not write the image to your server.

If you want to dive into this, check the following page.

http://nl.php.net/manual/en/function.imagecreatetruecolor.php

on the left, you can see all the GD2 commands. (oh yeah, GD2 library has to be installed, but I found it to be installed 9 out of 10 times.

You can also use imagecreate, but the difference is, that imagecreate is only limited to 256 colors, which can look bad if you start to get the hang of it, and are using backgrounds.

It really is a matter of copy/paste to get this script.

I bet you can write an image with text in about 10 commands.

First create the image, then set the colors, then write text, then print the headers, then print the image, then destroy the image to free up memory.

The example from imagecreate already gives you a working image.
« Last Edit: June 28, 2009, 21:09:53 by LPChip »
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline TechnoGeek

  • 238
  • 0
  • My new project, Notroid
    • View Profile
Re: Dynamic Sig Help
« Reply #4 on: June 29, 2009, 02:47:13 »
if you have php at all, you should be able to start with sending a header:
Code: [Select]
Content-Type: image/png\n\nor something similar, without needing any specific htaccess...i think. I really don't know php, though. just general web stuff, and some ASP
Spoiler: Technogeek's Signature (click to show/hide)

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: Dynamic Sig Help
« Reply #5 on: June 29, 2009, 19:12:46 »
if you have php at all, you should be able to start with sending a header:
Code: [Select]
Content-Type: image/png\n\nor something similar, without needing any specific htaccess...i think. I really don't know php, though. just general web stuff, and some ASP

The imagetools GD2 all give you that. But you need the extension .png if you want to have it supported on forums, because putting an [img]url[/img] anywhere with a .phpfile will not work. Security protection.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex