Current location: Hot Scripts Forums » Programming Languages » PHP » Embedding a text string onto a .png file.


Embedding a text string onto a .png file.

Reply
  #1 (permalink)  
Old 12-13-03, 03:57 PM
XxXoldsaltXxX XxXoldsaltXxX is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Embedding a text string onto a .png file.

I am a complete moron when it comes to PHP, and I can't figure out whats wrong with this script:

Code:
<?php
  header("Content-type: image/png");
  $fp = fopen("http://www.audiomatch.net/text/XxXoldsaltXxX.txt", "r");
  $content = ($fp, 10000000);
  fclose($fp);
  if(eregi('.*.', $content, $output)){
    function get_string($text){
        $text = substr($txt, 9, -2);
        $im = ImageCreateFromPng("$DOCUMENT_ROOT/music.png");
	  	$red = ImageColorAllocate($im,255,0,0);
	  	ImageTTFText ($im,10,0,5,15,$red,"kilroywashere.ttf",$text);
		ImagePNG($im);
		ImageDestroy($im);
		}
	} 
?>
Reply With Quote
  #2 (permalink)  
Old 12-13-03, 04:55 PM
XxXoldsaltXxX XxXoldsaltXxX is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
ahh! i almost got it!
http://s91276774.onlinehome.us/music.php

Code:
<?php
$fp = fopen("http://www.audiomatch.net/text/XxXoldsaltXxX.txt", "r");
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,0,0,0);
$textcolor = imagecolorallocate($img_number,255,0,0);
imagefill($img_number,0,0,$backcolor);
$number =  "Current jamz: $fp";
Imagestring($img_number,10,5,5,$number,$textcolor);
header("Content-type: image/png");
Imagepng($img_number);
?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM
Editing a text file. cjh_60 PHP 1 10-14-03 03:59 PM
Writes to a text file gamextremer2003 JavaScript 4 09-11-03 09:43 AM
text file to link rush989 Script Requests 3 08-29-03 06:12 PM


All times are GMT -5. The time now is 07:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.