Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Programming
Reload this Page php code not working with GD library
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
Junior Member
LoutheBrummy is on a distinguished road
 
Posts: 1
Join Date: Aug 2012
Default php code not working with GD library - 08-04-2012, 10:32 PM

Hello,

I have this php code with GD library functions and it is not working correctly.

http://xlouloux.net84.net/hello.php - here's the link, all it says it that it has errors.

I have put the png and the ttf files in the same directory as the php.

Please help, thanks.
__________________________________________________ ______
PHP Code:
<?php
header
('content-type: image/png');

// ---------- DO NOT EDIT ANYTHING ABOVE ----------

$name "Lou";
$image "IMAG0018.png";

$due_day 17;
$due_month 11;
$due_year 2013;

$font 'comic.ttf';
$fontsize 12;
$slant 0;
$margin_left 40;
$margin_top 250;

// shadow true or false
$shadow true;
$shadow_left 2;
$shadow_top 2;

// ignore these, go down 17 lines to change the font colour
$image imagecreatefrompng($image);
$red ImageColorAllocate($image25500);
$green ImageColorAllocate($image01530);
$blue ImageColorAllocate($image00255);
$black ImageColorAllocate($image000);
$white ImageColorAllocate($image255255255);
$yellow ImageColorAllocate($image2552550);
$aqua ImageColorAllocate($image0255255);
$fuschia ImageColorAllocate($image2550255);
$grey ImageColorAllocate($image153153153);
$lightgrey ImageColorAllocate($image187187187);
$silver ImageColorAllocate($image204204204);
$teal ImageColorAllocate($image0153153);
$lime ImageColorAllocate($image02550);
$navy ImageColorAllocate($image00153);
$purple ImageColorAllocate($image1530153);
$maroon ImageColorAllocate($image15300);
$olive ImageColorAllocate($image1531530);

// don't forget the font colour
$fontcolor $red;


// ---------- DO NOT EDIT ANYTHING BELOW ----------

// time variables
$today mktime();
$due mktime(000$due_month$due_day$due_year);
$total_pregnancy = (60*60*24*280);

// get timecode for time left in pregnancy
$diff = ($total_pregnancy - ($due $today));

// calculate weeks
$week = (60*60*24*(365/52));
$weeks intval($diff $week);
$diff $diff $week;

// calculate days
$day = (60*60*24);
$days intval($diff $day);
$diff $diff $day;

// text to superimpose onto the image
$text sprintf("%s is %s weeks and %s days pregnant"$name$weeks$days);

// make image
if ($shadow) {imagettftext($image$fontsize$slant$margin_left+$shadow_left$margin_top+$shadow_top$lightgrey$font$text); }
imagettftext($image$fontsize$slant$margin_left$margin_top$fontcolor$font$text);

// display image
imagepng($image);

// all done...
imagedestroy($image);
?>
__________________________________________________ ______

Last edited by d3iti; 08-05-2012 at 07:11 AM. Reason: Add [php tags
Reply With Quote
Sponsored Links
Reply

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com