Any PHP experts here?

Home Archive Serious Business Any PHP experts here?
O-Trap's avatar

O-Trap

Chief Shenanigans Officer

14,994 posts
Sep 13, 2012 11:56 PM
I have a .txt file that is a list. It looks like this:
Jay, Cutler
Ben, Roethlisberger
Aaron, Rodgers
Drew, Brees
etc.


Now, I'm trying to have a PHP page that will pull a row of data from the .txt file and display the values separately, AND I need it to rotate down to the next line each time the page loads.

Can this be done?

If so, I'd appreciate it.

Reps to whoever helps me figure it out.
Sep 13, 2012 11:56pm
J

Jawbreaker

Senior Member

520 posts
Sep 14, 2012 12:26 PM
Do you need it to rotate down when anyone loads the page or just when the same user loads the page?

You have to do this with a text file and not CSV or mySQL?
Sep 14, 2012 12:26pm
Belly35's avatar

Belly35

Elderly Intellectual

9,716 posts
Sep 14, 2012 12:34 PM
<img src="image.php" alt="Your ALT Text" />


<?php
// Defines the content as an PNG image
header("Content-type: image/png"
);

// Creates the image - edit those properties in order to change rotation and font types. I have defined two different fonts
$image = imagecreate(75, 70
);
$degrees = 40
;
$font = 'fonts/Jerry_B4s_handwriting.ttf'
;
$font1 = 'fonts/verdana.ttf'
;

// transparent color
$transparent_color = imagecolorallocate($image, 000, 0, 0
);

// set the transparent color
imagecolortransparent($image, $transparent_color
);

// fill the image with our transparent color
imagefilledrectangle($image,0,0,119,119,$transparent_color
);

//imagecolorallocate($image, R, G, B) in HEX values
$font_black = imagecolorallocate($image, 2, 1, 8
);

//EDIT those strings to output YOUR text
//outputs day
$string_day = date("l"
);
//outputs month, date
$string_rest = date("F d"
);
//outputs year
$string_year = date("Y"
);


//($image, fontsize, angle(use a combination of this and the $degrees variable), rightident(x), downindent(y), textcolor, font, data)
imagettftext($image, 13, -25, 10, 20, $black, $font, $string_day
);
imagettftext($image, 10, -25, 10, 40, $black, $font1, $string_rest
);
imagettftext($image, 9, -20, 10, 60, $black, $font1, $string_year
);

$rotate = imagerotate($image, $degrees,0
);
//Preserves transparency
imagealphablending($rotate, true
);
imagesavealpha($rotate, true
);

imagepng($rotate
);
imagedestroy($image
);
?>
<!-- php buffer end -->
Sep 14, 2012 12:34pm
sleeper's avatar

sleeper

Legend

27,879 posts
Sep 14, 2012 12:39 PM
PM sent to the user that would handle the answer best.
Sep 14, 2012 12:39pm
justincredible's avatar

justincredible

Nick Mangold

32,056 posts
Sep 14, 2012 1:04 PM
I just responded to your last PM. I think I understand what you're trying to do and gave you your solution. Hopefully it's what you were needing.
Sep 14, 2012 1:04pm
O-Trap's avatar

O-Trap

Chief Shenanigans Officer

14,994 posts
Sep 14, 2012 1:41 PM
Reply PM sent.

Also, lol @ Belly replying.

Somehow, I don't think Belly would ever get through scripting without a syntax error. :D
Sep 14, 2012 1:41pm
Belly35's avatar

Belly35

Elderly Intellectual

9,716 posts
Sep 14, 2012 2:57 PM
O-Trap;1270904 wrote:Reply PM sent.

Also, lol @ Belly replying.

Somehow, I don't think Belly would ever get through scripting without a syntax error. :D
I knew you see the humor :laugh:
Sep 14, 2012 2:57pm
O-Trap's avatar

O-Trap

Chief Shenanigans Officer

14,994 posts
Sep 14, 2012 3:13 PM
Belly35;1270982 wrote:I knew you see the humor :laugh:
I dig it, Belly. I definitely dig it.
Sep 14, 2012 3:13pm