Recent Topics

1 Jan 23, 2005 03:01    

This is just a nifty way to display your last entry on forums like this one. Ive included the code for b2evo and wordpress on my site. It was inspired by a similar one I saw on here the other day -- only the one I saw was hosted by a service. I prefer to host stuff myself if I have the choice.

The only thing you really have to be careful of is image restrictions that certain forum admins might have -- keep that in mind when creating your .png

lunarpages is in the middle of relocating all their servers to 1 Wilshire so my site may seem slow or be completely unaccessable for a bit.

An example is below, obviously.

3 Jan 24, 2005 08:24

Was your inspiration my signature ?

I tried yours yesterday and it worked. (offcourse ;))
It's just not a beautifull font, so, I'll stick to this animated signature I think.

4 Jan 25, 2005 00:42

yes, it was :)

Im toying with how i might mess with the font too.. just to see if i can do it

edit : very simple, took me 5 mins .. example : http://www.village-idiot.org/stat-thingy/newestpost1.php

now just need find the right font, I like that one but one font size smaller doesnt look as nice, and with longer posts, this size wont work.

a person could go ape-shit with this lemme tell ya :P

5 Jan 25, 2005 13:16

My animated signatures gets it's data from the atom.php file.
Is there some data in it, that you can use yourself, so you don't have to tweek in the edit_action.php file ?

6 Jan 26, 2005 01:47

dont know -- I'll betcha though that all feedreader does is parse the feed they get for your web site. Writing a script to parse a feed is a lot tougher than the 4 lines of extra code that go into what I did.

8 Jan 27, 2005 04:23

I actually have that font already, but thanks :)

Ive fixed up something else that I thought would be nice -- i now have image rotation, so rather than just one color, you can have as many as you like. The fixed up code for this will be in the next post I make about it on my site. i think I might code in a little if/else so that my text colors change as needed now too -- it can match my site more that way :) <-- done and very easy too

--

if you wanted to go small text wise, like topangas, you would definitely want to use a pixel font-- i love pixel fonts :) the only trouble with pixel fonts is that they dont scale well, in fact theyre really only good at 8px. 8px rendered using php doesnt really look (to me) like 8 pixels in photoshop when Ive used them (p-fonts) for other things. It would take a little screwing around to get the needed font size but Im sure it could be done, and look nice when finished.

I got two pretty cool trackbacks from my coming up with this, pretty cool B)

9 Feb 16, 2005 07:01

Hey, can you tell I have insomnia - have spent the last couple of hours giving this a go... you can see the result in my sig!

Had a few problems - wasn't quite clear about where everything went and such like (ie which paths to use - particularly the one to my posts... then it dawned on me that I needed to post a new article to get it to create the file...) but I was like a girl obsessed - and finally cracked it 8|

:lol:

Anyway thanks for this - I like it!!! Now I just have to come up with a selection of graphics so I can try out the random backgrounds...

Oh and it gave me an opportunity to do my very first trackback B)

10 Feb 16, 2005 18:14

i saw :) thankyou! and im glad you like !!

(yours is a good size, i might change mine)

11 Mar 11, 2005 22:19

I have a few questions...

I have looked at your site, and done what it says... Works

I read some of the posts after that, on this thread.

How do I change the font?

Is there a way to WRAP the text?

Mine looks okay, but you fint changes look cool...

12 Mar 12, 2005 09:13

Ioo wrote:

I have a few questions...

I have looked at your site, and done what it says... Works

I read some of the posts after that, on this thread.

How do I change the font?

Is there a way to WRAP the text?

Mine looks okay, but you fint changes look cool...

the font size is set inside the file ...


imagettftext($im, 9, 0, 60, 21, $treecolor, $font, $text);

the '9' in the above snippit is the font size, and I havent found or read of a way to wrap text using the file no. You could wrap text before you wrote to the temp file though but it would take a bit of work. Im using a basic arial font, i think, which accomodates longer post titles well, so I havent had to do that (yet).

hope that helps!

13 Mar 12, 2005 14:20

I don't have a line like that...

I took the code off your site as is (Changing the URL;s)

SO I have..

<?php
Header("Content-type: image/png");
Header("Expires: Mon, 1, 1999 05:00:00 GMT");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma: no-cache");

//***************
$u = $_GET['u'];
$foo2 = file('http://www.bushsamerica.com/admin/myposts');
$foo = join('', $foo2);
foreach($foo2 as $line_num => $line) {
      $ineedline = $line_num;
   }
$im = imagecreatefrompng("sig.png");
$mycolor = imagecolorclosest($im, 238, 0, 51);
imagestring($im, 3, 90, 10, "Latest Post:", $mycolor);
imagestring($im, 3, 90, 20, "$foo", $mycolor);
Imagepng($im,'',90);
ImageDestroy($im);
?>

Do you have an UPDATED code info...

I got it to work as is, but the font is just not right...

Thanks[/img]

14 Mar 12, 2005 15:54

their are atleast 3 versions on my site .. with minor changes in each..

your font is too small or too big??

you prolly want to grab the one that lets you use your choice of fonts :)


<?php
Header("Content-type: image/png");
Header("Expires: Mon, 1, 1999 05:00:00 GMT");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma: no-cache");

//***************
$u = $_GET['u']; 
$foo2 = file('http://www.yourdomain.com/path-to/myposts'); 
$foo = join('', $foo2); 
foreach($foo2 as $line_num => $line) { 
      $ineedline = $line_num; 
   } 


$im = imagecreatefrompng("sig.png");
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);


$text = 'Headline news:';
$font = 'FONT.TTF';  //Upload your font


imagettftext($im, 11, 0, 65, 22, $black, $font, $text);
imagettftext($im, 11, 0, 65, 43, $black, $font, $foo);


Imagepng($im,'',90);
ImageDestroy($im); 

?>

nice how that smilie showed up, sigh, check the code on my site @ http://www.village-idiot.org/archives/2005/01/24/improved-dynamic-signature/

edit: disabled the smiles since they hosed up the code

15 Mar 13, 2005 17:35

(You can check the "Disable Smilies" before you post BTW)

I got the code,,, and ALL I get is

The image ?http://www.bushsamerica.com/banner/banner.php? cannot be displayed, because it contains errors.

:| I am not sure

Here is the code

<?php
Header("Content-type: image/png");
Header("Expires: Mon, 1, 1999 05:00:00 GMT");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma: no-cache");

//***************
$u = $_GET['u'];
$foo2 = file('http://www.bushsamerica.com/admin/myposts');
$foo = join('', $foo2);
foreach($foo2 as $line_num => $line) { 
      $ineedline = $line_num;
   }


$im = imagecreatefrompng("sig.png");
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);


$text = 'Headline news:';
$font = 'pala.ttf';  //Upload your font


imagettftext($im, 11, 0, 65, 22, $black, $font, $text);
imagettftext($im, 11, 0, 65, 43, $black, $font, $foo);


Imagepng($im,'',90);
ImageDestroy($im);

?> 

Your thanks... If you tire of this, I understand, the other works well, and I am going to take you up on your advice on your blod and google some things as well. (See mom, I can read)

17 Mar 14, 2005 18:21

That is your original code, not the new stuff you posted...

18 Mar 14, 2005 19:11

wheres the new one?

20 Mar 15, 2005 04:39

oke..

is there a file called an error_log in the same dir as that? /banner/error_log?

21 Mar 15, 2005 07:19

Okay, I think I am doing something wrong here. This is what I get: http://the-fragile.org/posts/mypost.php

This is how I have my "myposts.php" setup:

<?php
Header("Content-type: image/png");
Header("Expires: Mon, 1, 1999 05:00:00 GMT");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma: no-cache");

//***************
$u = $_GET['u'];
$foo2 = file('http://www.the-fragile.org/blogs/admin/myposts');
$foo = join('', $foo2);
foreach($foo2 as $line_num => $line) {
      $ineedline = $line_num;
   }
$im = imagecreatefrompng("sig.png");
$mycolor = imagecolorclosest($im, 0, 0, 0);
imagestring($im, 3, 70, 15, "Latest Post:", $mycolor);
imagestring($im, 3, 70, 30, "$foo", $mycolor);
Imagepng($im,'',90);
ImageDestroy($im);
?>

And here is the code I inserted in the edit_actions.php:


		{	// We do all the pinging now!
			$blogparams = get_blogparams_by_ID( $blog );
			// trackback
			trackbacks( $post_trackbacks, $content, $post_title, $post_ID);
			// pingback
			pingback( $post_pingback, $content, $post_title, $post_url, $post_ID, $blogparams);
			pingb2evonet($blogparams, $post_ID, $post_title);
			pingWeblogs($blogparams);
			pingBlogs($blogparams);
			pingTechnorati($blogparams);
			$fp = fopen("myposts","w");
      $str = $post_title ;
      fwrite ($fp,$str);
      fclose($fp);

22 Mar 15, 2005 07:44

azel,

I cant tell EXACTLY what its inserting into the temp text file, then into the image.. but it looks like raw html? Check that file and let me know? Also, what version of b2evo? it looks to me like you did everything correctly..

23 Mar 15, 2005 07:59

Weirdly enough, it's inserting the admin login screen! I'm using version 0.9.0.11.

Hrm, now it says the image cannot be displayed because it contains errors.

24 Mar 15, 2005 08:19

i could be mistaken but i believe that "..image counldnt be displayed" .. gets accompanied with a standard php error_log, if so you might find some clue in it..

I can send anyone that needs them my own b2evo files (with the file edits) if they would like to diff them against their own.. There isnt alot of room for messups though (not a whole lot of editing), so I cant imagine anyone would need them -- but Im more than willing. If so, just drop me a pm, with an email, and I'll send em along.

25 Mar 17, 2005 17:41

Okay I think what I am having trouble understanding is in the "myposts.php" file, am I supposed to put

$foo2 = file('http://www.yourdomain.com/path-to/myposts'); 

exactly like that, only with my domain? Because I don't understand if I am supposed to link to my edit_actions file or what.

26 Mar 17, 2005 18:17

$foo2 = file('http://www.yourdomain.com/path-to/myposts');

thats the path to the temporary file that is written to when you create a new post

that temporary file should contain the title of your latest post, and will be overwritten when you do another post.

:)

27 Mar 17, 2005 20:11

Ohhh okay...sorry for the dumb questions. ;x

Edit: It works now, yay!

28 Mar 17, 2005 20:27

thats ok, better that you ask and it works than not ask and we both wonder why!!

29 Mar 17, 2005 21:27

Argh, another dumb question, this time regarding the .htaccess file. If I understand this correctly, I put the .htaccess in my root directory. And then I only need that one line in the .htaccess file?

31 Mar 17, 2005 21:34

Ahh, I must not be able to use .htaccess then, because using it gives me an internal server error for my whole site. Darnit.

32 Mar 17, 2005 23:56

it shouldnt ...

something like this...


Redirect permanent /newestpost.png http://www.village-idiot.org/stat-thingy/newestpost.php

should not affect your entire site, under any circumstances

if you have cpanel access, i would go in and check the error in the error log, see exactly what it says.

34 Mar 19, 2005 10:39

every village needs an idiot to teach the rest.

i still can't figure how to change font color, oh well, after two hours i'm satisfied with what i've got.

35 Mar 19, 2005 11:03

are you using the last bit of code changes, meistercobbman?

36 Mar 20, 2005 05:58

Okay...why all of a sudden would it stop working? Edit: Maybe it was my server last night, because it works again today. Sorry for that. :/

38 Mar 31, 2006 00:58

I LOVE this hack, but I think I noticed a small bug.

I often write blog entries with pictures, and sometimes I'll write them, save them as draft, and then add the pictures later on and publish them.

When I write a blog entry from scratch and publish it immediately, it puts the title in "myposts" just like it's supposed to. However, when I change the status of a Draft entry to Published, it doesn't put the title in "myposts".

Is this normal? Is there any way to fix this?

39 Mar 31, 2006 05:59

Nevermind, I figured it out.

In in the case 'editpost' section, find:

			else
			{	// We'll ping now
				pingb2evonet( $blogparams, $post_ID, $post_title );
				pingWeblogs( $blogparams );
				pingBlogs( $blogparams );
				pingTechnorati( $blogparams );

And add:

$fp = fopen("myposts","w"); $str = $post_title ; fwrite ($fp,$str); fclose($fp);

This will let your dynamic signature work when you're switching from Draft to Published.

40 Jun 27, 2006 19:03

Quick question... Is there any way to add a second line with the $post_date variable in it?

I tried, but my php-fu is weak.

41 Jun 27, 2006 20:40

yeah you could do that; I cant tell you exactly HOW to do it today though -- someone else might though :)

If it hasnt bene answered by this Friday, ILL post back with the answer for ya (my work hours take precedence over most other things, unfortunately)

42 Jun 27, 2006 20:51

Not a problem. :) I remember work...

43 Jun 27, 2006 21:12

I do believe I saw the second line in my siggy..

try this, back up the file and then edit admin/edit_actions.php


$fp = fopen("myposts","w"); 
$str = $post_title;
$str2 = $post_date; <-- check to make sure thats the right variable before using it 
fwrite($fp, $str."\n".$str2); 
fclose($fp);

Just a heads up too, that the one line of code in admin/edit_actions.php is actually multiple commands seperated by ;s and check to make sure that that $post_date variable is correct also.

44 Jun 28, 2006 01:13

Well, the variable is right... But the fwrite isn't quite there...

45 Jun 28, 2006 01:40

what is it writing, if anything? Im at work, so I wont be able to do much more before I get home.

46 Jun 28, 2006 02:45

Looks like my current .sig on here..

Saying Goodbye...vt2006-06-27 13:48:15

The title and date/time are right, but instead of a newline, it's converting to "vt".

47 Jun 28, 2006 06:18

oke, i can prolly fix that when i get home from work. :)

48 Jun 28, 2006 11:30

Ive checked this at home and that code works for writing the 2 lines, so you have either messed up the copy and paste or ...??
For instance, I am testing with :

$fp = fopen("myposts","w");
$str = $post_title;
$str2 = $now;
fwrite($fp, $str."\n".$str2);
fclose($fp);

That outputs 2 lines to my writable file:

123
2006-06-28 02:17:43

You can actually see it in my current signature :)

$now is variable you prolly dont have, and $post_date isnt pretty, so rather than rebuilding the date, I would just do this:

$str2 = date("m/d/y"); 

---
Final product:

$fp = fopen("myposts","w");
$str = $post_title;
$str2 = date("m/d/y");
fwrite($fp, $str."\n".$str2);
fclose($fp);

I will go doublecheck to see that that works.....

works perfectly, Actual output:

post and date
06/28/06

If you look closely the date is hanging off the image in my signature

49 Jun 28, 2006 11:35

the vt in your writable file, is it just a normal looking vt, or is it subscript or anything? because it doesnt look "normal" in your image.

I think thats "vertical tab" maybe? check to make sure you didnt typo a v for an n?

50 Jun 28, 2006 16:11

No typo, and it looks like a superscript vt.

I'm thinking it may be on the server end. Gonna check it out in a minute when I make my next post...

Nope, still doing it. :(

51 Jun 29, 2006 00:34

ok, well we can try another way, breaking up the 2 lines.. ill post that way when i get home from work tonight :)

52 Jul 01, 2006 07:01

have you tried this:

$fp = fopen("myposts","w");
$str2 = $post_title;
$str = date("m/d/y");
fwrite($fp, $str."\n");
fwrite ($fp,$str2);
fclose($fp);

im guessing the above wont work for you if the other didnt, but its worth a try. And dont be confused by my changing the str/str2 variables, it was just easier in my paste.

OR ....

maybe this:


$str = date("m/d/y");
$newestpost="$str."\n".$post_title";
fwrite ($fp,$newestpost);
fclose($fp);

53 Jul 01, 2006 10:33

A while ago i did a script where if the text exceeds a certain size, make it 2 lines, and if it is still to large add a '...' or ' ...' apropriatly, i can post it if it might be of use.

54 Jul 01, 2006 16:48

my first suggestion to cuddle's question is the documented solution via php.net to use fwrite with 2 lines of text. It functions correctly and as expected on my host's box, so I know it works. My last post prior to this one includes derivitive ways that ive provided in the hopes one of those might work. If you can provide anything different for cuddles that might work, feel free, however due to the fact that \n is being interpreted incorrectly, I am guessing its a box issue and not a script issue.

55 Jul 01, 2006 20:07

Nope, neither of those worked... I spoke with my host's tech support, and it IS an issue on the box. Good news is, they're working on it.

56 Aug 27, 2006 18:20

How can I separate the blogs? If I have different users with different blogs. I would like user 1 have a file of his choice and user 2 a file of his choise. Is it possible. Ad also how did Topanga put in the subscribe function in the sig.

Thanks for a great script :)

http://kamero.se/newestpost.png


Form is loading...