|
-
Mar 1st, 2005, 11:12 AM
#1
Thread Starter
Frenzied Member
Simple Quetion, Read top line of text file... HELP [nooooob]
Ok, all i want this to do is read the top line of a file called Song.txt (which resides in the same directory)
i want it to be the text attribute of the coding, i hope you understand what i mean.
This should be really simple, but i am a total noobie to this, and i am using the GDI library to draw an image.
heres my code, i hope you can edit it to work. thanks.
Code:
<?php
// You need this to make sure that browsers read this as an image
header("Content-type: image/png");
$font_size = 14;
// Text to output
$text = $_GET['text'];
// Location of the base graphic
$base = $_GET['image'];
// Colors in RGB format for the TEXT
// This is NOT Hex (#) format
// To get the RGB values for a color, use something like photoshop
$r = "255";
$g = "255";
$b = "255";
// Code to create the actual image
$im = imagecreatefrompng($base);
$color = imagecolorallocate($im, $r, $g, $b);
// X-Position of Text [directly in middle with this code]
// Change the 6 to a different value based on the font you pick later on
$px = (imagesx($im) - 15 * strlen($text)) / 2;
// Y-Position of Text
// Change this based on the X-Position and Font if needed
$py = '18';
// Font (1 = small/pixel, 2 = similar to verdana, 3 = large/bold, etc)
$font = $_GET['font'];
imagettftext($im, $font_size, 0, $px, 30, $black, $font, $text);
imagepng($im);
imagedestroy($im);
?>
thankyou.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|