Closed Thread Icon

Topic awaiting preservation: Printing random text on an image (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12678" title="Pages that link to Topic awaiting preservation: Printing random text on an image (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Printing random text on an image <span class="small">(Page 1 of 1)</span>\

 
Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-03-2003 05:36

OK, I have a new sig on display, and what I would like to do with it is have a script that will take a random line from a text file and put it into the "paper" space (take a look at the sig and you'll see exactly what I mean). Lurch mentioned that this was doable in PHP, but I haven't quite gotten that far yet...

Any tips?

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 04-03-2003 05:43

Go to http://www.hotscripts.com and look through their PHP tutes on image manipulation...then when you've done it and amazed us all with your talent write it up as a tute for the GN.

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-03-2003 06:09

Thanks for the link... although I probably won't get around to this until sometime next week.

Don't know if I'm really qualified to write up a GN tut, though.

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 04-03-2003 06:27

I'll let you in on a little secret Master Suho...if you can do it, you're qualified ot write about how you did it.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-03-2003 06:55

Actually these tutes can be much better by someone with less knowlege sometimes. They're written by people who can understand the difficulty of what they are trying to teach

Heck a diary of how you figured out how to do it can be extremely helpful to some

The easy way can be using one of the GD funcitons in php like imagettftext but your php install needs the GD library installed.



.:[ Never resist a perfect moment ]:.

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-03-2003 08:05

Skaarjj: So that's the secret, eh? I'll keep that in mind.

bd: Ah, yep. I imagine I will need to be using that function. Fortunately we do have the GD library installed...

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-03-2003 08:40

Huh... apparently getting the stupid imagettftext function to work is going to be the hard part... I keep getting:

"Warning: Supplied argument is not a valid Image resource"

What the heck is that supposed to mean? The file is there... does thing only work for jpegs? 'cause that would kind of suck, you know, with no transparency and all

*goes back to look at the documentation*

[Edit: OK, this is apparently a heck of a lot more complicated than it would seem... I have to create an image for GD to use, but I don't see anywhere in the imagecreate function that tells me where I can actually specify the image file. I so do not understand what is going on here... and I thought this was going to be fairly easy.]

[Edit: Well isn't that wonderful... I finally figure out how to do it (createimagefromgif) and it tells me that there is "No GIF read support in this PHP build." Grrr.....]

[Edit: Ah, but there is support for PNG... now I just have to figure out how to get it to read the font file. You wanted a diary, db? Well here it is. ;-)]

[Edit: Yes! No errors (just needed the full path, apparently)! Now I just have to figure out why I'm staring at a blank screen. My, this is fun.]

[Edit: Haha... Yes, I suppose I should actually output the image now, eh? *smacks forehead*]

[Edit: Yep, that was it. I am such a moron... OK, it actually works. Now I just need to go off and do some fine-tuning (and implement the random quote thingy, which shouldn't be too difficult... famous last words, heh). OK, shows over.]

[This message has been edited by Suho1004 (edited 04-03-2003).]

[This message has been edited by Suho1004 (edited 04-03-2003).]

[This message has been edited by Suho1004 (edited 04-03-2003).]

[This message has been edited by Suho1004 (edited 04-03-2003).]

[This message has been edited by Suho1004 (edited 04-03-2003).]

[This message has been edited by Suho1004 (edited 04-03-2003).]

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-03-2003 17:21

see what I'm saying

So when you write this up the one piece you may want to mention is that most PHP installs even with GD won't support GIF's because CompuServe got all uppity a couple of years ago and started suing people using the GIF format. Anyway PNG is much cooler anyway and should be a new standard.



.:[ Never resist a perfect moment ]:.

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-04-2003 00:50

Yup, I will definitely have to mention that. Although I've been having trouble getting a transparent PNG to work... if I can't figure it out I may go with my alternate version (a transparent GIF + a JPG with the text)...

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-04-2003 03:46

Skaarjj and bd: Much thanks for the help and encouragement. I've posted the final version over in the sigs forum, but I thought I'd post it over here, just in case you don't get over that way. In the end, it didn't turn out to be nearly as difficult as I thought it would be...



Now... I guess I should submit a tut proposal over at GN...

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 04-04-2003 05:06

Good work Suho! This is another sig mile-stone for the asylum!

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 04-04-2003 19:48

Ah! Now that's gold Jerry! Gold!

Good work on that SuHo. How 'bout sharing that code with us I have often wondered how you could do that. However, my laziness got the best of me.

Later,

C:\


~Binary is best~

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

posted posted 04-05-2003 14:30

All in good time, my friend, all in good time. The code will soon be appearing in a tutorial over at GN...

« BackwardsOnwards »

Show Forum Drop Down Menu