Creating a dynamic signature

Anything technology related that does not fit in other categories
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Lot of forums don't allow images that don't have a .gif,.jpg .png (and some others) extension. So make sure your "fake" image has a .jpg extension,t his is why the .htaccess part is important. It makes .jpg files parse as php, in the folder specified.

Archived topic from Iceteks, old topic ID:1293, old post ID:25550
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Unfortunatly the re's not, at least I'm not aware of a way. Only way is to set .jpg's in the folder to parse as php, using .htaccess. You could keep it to .php and use that as an image, but if you want to post it to a forum or something it probably won't let you, since most forums only allow specific extensions.

Archived topic from Iceteks, old topic ID:1293, old post ID:26646
Honk if you love Jesus, text if you want to meet Him!
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Sticking with a php extension and seeing if everything works like that will probably help to confirm that the problem is the .htaccess file but as Red Squirrel says you'll have problems using the image on forums.

Archived topic from Iceteks, old topic ID:1293, old post ID:26648
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

hmm. Indeed I don't think the .htaccess is causing my troubles as I can get a different dynamic signature to work:

http://www.a-base.dds.nl/sigtest/random_images_signature.php

I have found code for a dynamic signature to display text feeded by RSS here.
This is an example.

I've been fiddling around with the code they give but I just can't get it to work:

http://www.a-base.dds.nl/sig_rss/rss_image_b.php
http://www.a-base.dds.nl/sig_rss/rss_image_b.txt <-code

Do any of you have an idea as to what might cause the problem?

Archived topic from Iceteks, old topic ID:1293, old post ID:26688
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Is that the code they give or the code you are currently working with? If it is the original code they give have you changed the source image and if so what to?

A scan revealed the following errors

Unused function argument: $parser (line 38)
Unused function argument: $attrs (line 38)
Unused function argument: $parser (line 48)
Unused function argument: $name (line 48)
Unused function argument: $parser (line 52)
Assignment in condition (line 84)

I don't have time to look at it in much more detail just for the moment but I'll take a second look later.


Archived topic from Iceteks, old topic ID:1293, old post ID:26691
Image
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Scan? Do you have a tool to scan php for issues? or do you mean you did it by looking? Would be a neat tool to have, especially for large scripts.

Archived topic from Iceteks, old topic ID:1293, old post ID:26695
Honk if you love Jesus, text if you want to meet Him!
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Streety wrote: Is that the code they give or the code you are currently working with? If it is the original code they give have you changed the source image and if so what to?

A scan revealed the following errors

Unused function argument: $parser (line 38)
Unused function argument: $attrs (line 38)
Unused function argument: $parser (line 48)
Unused function argument: $name (line 48)
Unused function argument: $parser (line 52)
Assignment in condition (line 84)

I don't have time to look at it in much more detail just for the moment but I'll take a second look later.
Check post #9 on that page I gave to see the original code. As you can see I barely changed it except for the image and rss link. The only important thing I changed to prevent php from giving error's was change this:

function charData($parser, $data) {
global $store, $array;


into this:


function charData($parser, $data) {
global $store, $array, $count, $maxent;

Archived topic from Iceteks, old topic ID:1293, old post ID:26699
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Red Squirrel wrote: Scan?  Do you have a tool to scan php for issues?  or do you mean you did it by looking?  Would be a neat tool to have, especially for large scripts.
I have a trial copy of Zend Development Environment 3.5.0. You know those trials you get from certain places on the internet. ;)

It's 30 Mb if you want me to send it to you.

ZenithalRavage, are you aware you're using a different version of rss? I don't know if that would make any difference though.

Archived topic from Iceteks, old topic ID:1293, old post ID:26701
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Streety wrote: ZenithalRavage, are you aware you're using a different version of rss?  I don't know if that would make any difference though.
Yea I noticed, but I tried it with different RSS feeds (2.0) and that doesn't make a difference :(

thanx for noticing though ;)

this is pretty weird though, I changed the feed to another again now and when I refresh my sig quicky sometimes it does show the image but never with any text. Could this be because this feed might be slower or something?

http://www.a-base.dds.nl/sig_rss/rss_image_b.php
http://www.a-base.dds.nl/sig_rss/rss_image_b.txt <-code

Archived topic from Iceteks, old topic ID:1293, old post ID:26702
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Yeah I'm getting the same thing, you have to click it fairly fast though (you must have been desperate!). You could try saving the file to your own server, that should make it faster but it would seem unlikely that that's the error.

I'm playing around with creating images myself now and I'm reminded just what a pain it is. I don't know if it will work for you as your code is more complex but i'm going through my code and editing it out between note tags (i.e. /* */). I started off hiding everything and have finally got it down to just one line. I've still no idea what the problem is but at least I know where the problem is. It's back to http://www.php.net for me.

Archived topic from Iceteks, old topic ID:1293, old post ID:26703
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Streety wrote: Yeah I'm getting the same thing, you have to click it fairly fast though (you must have been desperate!). You could try saving the file to your own server, that should make it faster but it would seem unlikely that that's the error.

I'm playing around with creating images myself now and I'm reminded just what a pain it is. I don't know if it will work for you as your code is more complex but i'm going through my code and editing it out between note tags (i.e. /* */). I started off hiding everything and have finally got it down to just one line. I've still no idea what the problem is but at least I know where the problem is. It's back to http://www.php.net for me.
hmm. I think the problem is with my host because I tested the standard example code the PHP manual gives for the imagettftext function and that gives me the same error!
http://www.a-base.dds.nl/sig_rss/test.php
http://www.a-base.dds.nl/sig_rss/test.txt <-code

I emailed my host about this, I'll keep you all informed

Archived topic from Iceteks, old topic ID:1293, old post ID:26704
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

oops sorry doublepost (page hung after reply so I pressed add reply again)

Archived topic from Iceteks, old topic ID:1293, old post ID:26705
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

I've just run it on my server and it also gives an error.

Using the following code though appears to work

Code: Select all

<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreate(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = 'Testing...';

ImageFill($im, 0, 0, $grey);
imagestring($im, 5, 5, 5, $text, $black);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?> [code]

Instead of using imagettftext I just used imagestring.  It must be imagettftext that is causing the problem.  Presumably you need to get the tff file from somewhere and enclose it in the folder. 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:1293, old post ID:26706[/size][/color]
Image
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

The code on the php site does work.

Code: Select all

<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreate(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?> [code]

If you're on a windows xp machine just go to C:WINDOWSFonts select your font (I just stuck with arial) and copy that into the directory of your web server.  I couldn't copy the file from inside windows explorer but my ftp client had no trouble. 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:1293, old post ID:26707[/size][/color]
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Streety wrote: If you're on a windows xp machine just go to C:WINDOWSFonts select your font (I just stuck with arial) and copy that into the directory of your web server. I couldn't copy the file from inside windows explorer but my ftp client had no trouble.
Imagestring works for me too :)

I have uploaded arial.ttf to the same folder, even put that putenv GDFONTPATH in there but alas still nogo, I'm waiting what my host has to say about this....

Archived topic from Iceteks, old topic ID:1293, old post ID:26735
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Good old imagestring! :D

That imagettftext doesn't work even with the ttf file in the same folder for you is odd. That code worked perfectly for me. Hopefully your host will know what the problem is.

Archived topic from Iceteks, old topic ID:1293, old post ID:26737
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Guest wrote: dynasig.net
that's pretty cewl, but I'm trying to make a dynamic sig with RSS feed.

I've tried altering the code I have to use imagestring instead of imagettftext, this made it to produce an image at least, but with only four zero's. Changing the feed does not help. I wonder if I can achieve this at all using imagestring. Any idea's?

http://www.a-base.dds.nl/sig_rss/rss_image_d.php
http://www.a-base.dds.nl/sig_rss/rss_image_d.txt <-code

Still haven't heard from my host....

Archived topic from Iceteks, old topic ID:1293, old post ID:26739
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Hey I'm getting closer!

I had to rearrange the code a bit behind imagestring but at least it's taking info from the feed now!

http://www.a-base.dds.nl/sig_rss/rss_image_d.php
http://www.a-base.dds.nl/sig_rss/rss_image_d.txt <-code

woei!

Archived topic from Iceteks, old topic ID:1293, old post ID:26740
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Sorry for posting again, but this imagestring isn't half bad, see what I baked in the oven:

http://www.a-base.dds.nl/sig_rss/zr_sig_rss.php :banana:

Archived topic from Iceteks, old topic ID:1293, old post ID:26741
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Streety
Posts: 182
Joined: Mon Aug 16, 2004 7:12 pm

Creating a dynamic signature

Post by Streety »

Hey, that is getting better! :)

The text starts to fade out a bit as it goes across into the darker background. You could try creating a shadow as in the script from the php.net site. Might make it a bit more clear.

Archived topic from Iceteks, old topic ID:1293, old post ID:26742
Image
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

Streety wrote: Hey, that is getting better! :)

The text starts to fade out a bit as it goes across into the darker background. You could try creating a shadow as in the script from the php.net site. Might make it a bit more clear.
thanx, well I lightend the background a bit more, this is pretty much how I want it ;)
sig's here don't allow hyperlinking an image that sucks but this is possible on almost every other site I'm on so there the image links to my site, pretty cool stuff B)

Archived topic from Iceteks, old topic ID:1293, old post ID:26749
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
ZenithalRavage
Posts: 11
Joined: Fri May 06, 2005 2:53 pm

Creating a dynamic signature

Post by ZenithalRavage »

phew, Imagettftext works now! I got a reply from my webhost and all I had to do was put ./ infront of the fontname, so instead of:

$font = "arial.ttf";

this:

$font = "./arial.ttf";

sheesh :huh:

So if someone has similar problems and the host does not allow the GDFONTPATH command, this could be your solution ;)

Archived topic from Iceteks, old topic ID:1293, old post ID:26791
Image

*ZR*'s Hideout!

"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all run around in a darkened room munching pills and listening to repetitive music." - Kristian Wilson, Nintendo Inc.
Locked