Last edited:
Hahaha, nope but i've been called VASTLY worse!Jeremy. I've only just clicked on your link and seen this. Have you ever heard the expression "silly sausage" haha
Like you banner Jeremy. How does one get it?Hahaha, nope but i've been called VASTLY worse!
Sort of, yeah. It's on the members page. Look to the side.I bet. I wonder if they announce your birthday on here. They do on some forums
I made mine myself, based on code i cobbled together from various sources. I haven't coded in several years but dammit i just had to have a banner, and i had to have it exactly like i wanted it. It's written in PHP. If you have a host, i could post the code, but i've got to sterilize and neutralize it first.Like you banner Jeremy. How does one get it?
I made mine myself, based on code i cobbled together from various sources. I haven't coded in several years but dammit i just had to have a banner, and i had to have it exactly like i wanted it. It's written in PHP. If you have a host, i could post the code, but i've got to sterilize and neutralize it first.
I don't even know what that is. There's no CSS involved at all. I think that's just what Opera uses to display a lone image. Anyway, the code is server-side, so you're not even looking at it at all. But i'm posting it here anyway.Nice..I haven't coded one of those in years either.
My poor Opera 12.16 browser is feeling badly that your script thinks it's on a console or phone though..
View attachment 2079
Don't worry, I didn't show the script...
<?php
/*
********************************************************************************************
* x jeremy jarratt coded this terribly didn't he - http://jeremyjarratt.com/ - @transmothra
* PRAISE DOBBS! HAIL ERIS! ALL HAIL DISCORDIA!
* This work is licensed under the
* Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
********************************************************************************************
*/
// EDIT THESE NEXT FEW LINES
// set your timezone or suffer the consequences
date_default_timezone_set('America/New_York');
// set your quit date
$quitdate = "2010-08-16"; // change this to your quit date
// how much is a pack of smokes worth where you live?
$cigprice = 5.00; // omit the dollar sign
// how many packs per day did you smoke?
$packsperday = 2.5; // decimals ok
// how much do you spend on vaping per month?
$vapecostmonthly = 30; // omit the dollar sign
// set your font by filename - UPLOAD YOUR FONT FILE TO THE SAME DIRECTORY
$font = './trebuc.ttf';
$fontb = './trebucbd.ttf';
// number of pixels for the left margin
$left_margin = 5;
// HEY LET'S CALCULATE A BUNCH OF CRAP (in general, leave this alone)
$now = time(); // this is really NOW, for comparison to your quit date
$your_date = strtotime($quitdate);
$datediff = $now - $your_date; // compare your quit date to right now (output in seconds)
$datetime1 = new DateTime($quitdate);
$datetime2 = new DateTime();
$interval = date_diff($datetime1, $datetime2); // just another time comparison
$howlong = $interval->format('%y years, %m months, %d days');
$vapedays = floor($datediff/(60*60*24)); // convert time since quitting to days (rounded down to eliminate any remainder)
$vapecostdaily = $vapecostmonthly/30; // divide monthly cost by 30 for a daily cost
$vapecost_ttl = $vapecostdaily*$vapedays; // multiply daily vape cost by total days since quitting
$vapesaved = $vapedays*$cigprice*$packsperday-$vapecost_ttl; // days x cost x ppd, minus vaping costs
$cigsavoided = $packsperday*20*$vapedays; // ppd x 20 smokes per pack x total days since quitting
$packs = $cigsavoided/20; // total number of packs avoided since quitting
// format numbers: decimal places, decimal separator, thousands separator
$vapesaved = number_format($vapesaved, 2, '.', ',');
$cigsavoided = number_format($cigsavoided, 0, '.', ',');
$packs = number_format($packs, 0, '.', ',');
$vapedays = number_format($vapedays, 0, '.', ',');
// put in a bunch of quotes or whatever you want; space is limited!; rotated on a random basis
$randomquote = array(
'The SubGenius must have SLACK! (B.Dobbs)',
'Hail Eris! All Hail Discordia!',
'How can I be free in the shadow of a chapel? (anon)',
'Act like a dumbshit and they\'ll treat you like an equal (B.Dobbs)',
'Nature abhors a moron. (HL Mencken)',
'Puritanism: The haunting fear that someone, somewhere, may be happy. (HL Mencken)',
'The highest understanding we can achieve: laughter & human compassion. (Feynman)',
);
$quotation = $randomquote[rand(0, sizeof($randomquote) - 1)];
// DON'T EDIT UNLESS YOU KNOW WHAT YOU'RE DOING
$image = 'signature_bar.png'; // create a banner image with this name; 468 pixels wide by 60 pixels tall
$im = imagecreatefrompng($image);
// set colors (RGB)
$main_color = imagecolorallocate($im, 51, 102, 153);
$black = imagecolorallocate($im, 0, 0, 0);
$orange = imagecolorallocate($im, 255, 140, 0);
$blue = imagecolorallocate($im, 216, 196, 255);
$red = imagecolorallocate($im, 255, 0, 0);
$green = imagecolorallocate($im, 0, 160, 0);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 216, 216, 216);
$yellow = imagecolorallocate($im, 255, 216, 64);
// THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text
// Add the text - drop shadow
imagettftext($im, 12, 0, $left_margin-2, 18, $black, $fontb, 'Vaping since 16 August 2010; '.$howlong);
imagettftext($im, 10, 0, $left_margin-2, 34, $black, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs');
imagettftext($im, 10, 0, $left_margin-2, 50, $black, $font, 'Money spent on better things: $'.$vapesaved);
imagettftext($im, 8, 0, $left_margin-1, 65, $black, $fontb, $quotation);
// Add the text
imagettftext($im, 12, 0, $left_margin, 16, $orange, $fontb, 'Vaping since 16 August 2010; '.$howlong);
imagettftext($im, 10, 0, $left_margin, 32, $blue, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs');
imagettftext($im, 10, 0, $left_margin, 48, $white, $font, 'Money spent on better things: $'.$vapesaved);
imagettftext($im, 8, 0, $left_margin, 64, $yellow, $fontb, $quotation);
// LEAVE THESE ALONE DAMN YOU
header('Content-Disposition: filename=signature_bar.png');
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
Well, I would hope the PHP script is server-side.I don't even know what that is. There's no CSS involved at all. I think that's just what Opera uses to display a lone image. Anyway, the code is server-side, so you're not looking at it at all. But i'm posting it here anyway.
Right. So why were you trying to imply that you could actually see the code underneath? Or that Opera's own stylesheet was somehow part of it?Well, I would hope the PHP script is server-side.
It's just Dragonfly viewing the signature_bar.php.
Right. So why were you trying to imply that you could actually see the code underneath? Or that Opera's own stylesheet was somehow part of it?
That makes so much more sense now. Get some sleep!Bah, it's late, I've been up for like 16 hrs and I just saw it wrong.
What happens when you try to update it?In my profile it written that I'm from 1 January 1970 that's 44 years, but I'm from 20 June 1978 LoL Don't know what happened when I was putting up my account, but know for sure that I didn't write that in it. Hehehe
Thank YouThis is probably super-inefficient code. It's been the better part of a decade since i've written anything at all. Feel free to tidy it up. I tried to comment the shit out of it for clarity; for best results, remove all that crap once you understand what you're doing.
Lastly, as evidenced in my original post on this thread, i'm clearly AWFUL at even the simplest math, so as the Department of Homeland Security might say, "if you see something, say something."
signature_bar.php
PHP:<?php /* ******************************************************************************************** * x jeremy jarratt coded this terribly didn't he - http://jeremyjarratt.com/ - @transmothra * PRAISE DOBBS! HAIL ERIS! ALL HAIL DISCORDIA! * This work is licensed under the * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. ******************************************************************************************** */ // EDIT THESE NEXT FEW LINES // set your timezone or suffer the consequences date_default_timezone_set('America/New_York'); // set your quit date $quitdate = "2010-08-16"; // change this to your quit date // how much is a pack of smokes worth where you live? $cigprice = 5.00; // omit the dollar sign // how many packs per day did you smoke? $packsperday = 2.5; // decimals ok // how much do you spend on vaping per month? $vapecostmonthly = 30; // omit the dollar sign // set your font by filename - UPLOAD YOUR FONT FILE TO THE SAME DIRECTORY $font = './trebuc.ttf'; $fontb = './trebucbd.ttf'; // number of pixels for the left margin $left_margin = 5; // HEY LET'S CALCULATE A BUNCH OF CRAP (in general, leave this alone) $now = time(); // this is really NOW, for comparison to your quit date $your_date = strtotime($quitdate); $datediff = $now - $your_date; // compare your quit date to right now (output in seconds) $datetime1 = new DateTime($quitdate); $datetime2 = new DateTime(); $interval = date_diff($datetime1, $datetime2); // just another time comparison $howlong = $interval->format('%y years, %m months, %d days'); $vapedays = floor($datediff/(60*60*24)); // convert time since quitting to days (rounded down to eliminate any remainder) $vapecostdaily = $vapecostmonthly/30; // divide monthly cost by 30 for a daily cost $vapecost_ttl = $vapecostdaily*$vapedays; // multiply daily vape cost by total days since quitting $vapesaved = $vapedays*$cigprice*$packsperday-$vapecost_ttl; // days x cost x ppd, minus vaping costs $cigsavoided = $packsperday*20*$vapedays; // ppd x 20 smokes per pack x total days since quitting $packs = $cigsavoided/20; // total number of packs avoided since quitting // format numbers: decimal places, decimal separator, thousands separator $vapesaved = number_format($vapesaved, 2, '.', ','); $cigsavoided = number_format($cigsavoided, 0, '.', ','); $packs = number_format($packs, 0, '.', ','); $vapedays = number_format($vapedays, 0, '.', ','); // put in a bunch of quotes or whatever you want; space is limited!; rotated on a random basis $randomquote = array( 'The SubGenius must have SLACK! (B.Dobbs)', 'Hail Eris! All Hail Discordia!', 'How can I be free in the shadow of a chapel? (anon)', 'Act like a dumbshit and they\'ll treat you like an equal (B.Dobbs)', 'Nature abhors a moron. (HL Mencken)', 'Puritanism: The haunting fear that someone, somewhere, may be happy. (HL Mencken)', 'The highest understanding we can achieve: laughter & human compassion. (Feynman)', ); $quotation = $randomquote[rand(0, sizeof($randomquote) - 1)]; // DON'T EDIT UNLESS YOU KNOW WHAT YOU'RE DOING $image = 'signature_bar.png'; // create a banner image with this name; 468 pixels wide by 60 pixels tall $im = imagecreatefrompng($image); // set colors (RGB) $main_color = imagecolorallocate($im, 51, 102, 153); $black = imagecolorallocate($im, 0, 0, 0); $orange = imagecolorallocate($im, 255, 140, 0); $blue = imagecolorallocate($im, 216, 196, 255); $red = imagecolorallocate($im, 255, 0, 0); $green = imagecolorallocate($im, 0, 160, 0); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 216, 216, 216); $yellow = imagecolorallocate($im, 255, 216, 64); // THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text // Add the text - drop shadow imagettftext($im, 12, 0, $left_margin-2, 18, $black, $fontb, 'Vaping since 16 August 2010; '.$howlong); imagettftext($im, 10, 0, $left_margin-2, 34, $black, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs'); imagettftext($im, 10, 0, $left_margin-2, 50, $black, $font, 'Money spent on better things: $'.$vapesaved); imagettftext($im, 8, 0, $left_margin-1, 65, $black, $fontb, $quotation); // Add the text imagettftext($im, 12, 0, $left_margin, 16, $orange, $fontb, 'Vaping since 16 August 2010; '.$howlong); imagettftext($im, 10, 0, $left_margin, 32, $blue, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs'); imagettftext($im, 10, 0, $left_margin, 48, $white, $font, 'Money spent on better things: $'.$vapesaved); imagettftext($im, 8, 0, $left_margin, 64, $yellow, $fontb, $quotation); // LEAVE THESE ALONE DAMN YOU header('Content-Disposition: filename=signature_bar.png'); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?>
Aha yes. That's what I meant. TaSort of, yeah. It's on the members page. Look to the side.
You don't look old enough to be on this forum ≧◔◡◔≦nobody will know my real age anyhoo, cause i only put down my month and day.....no year. View attachment 2089
You don't look old enough to be on this forum ≧◔◡◔≦
Mine is set the same. Pretty sure it came from default Tapatalk settings when I first joined here, and joined through the Tapatalk interface.In my profile it written that I'm from 1 January 1970 that's 44 years, but I'm from 20 June 1978 LoL Don't know what happened when I was putting up my account, but know for sure that I didn't write that in it. Hehehe
Aww thx ☆ミ we should definitely suggest a love buttoni did just like you....now i love you.
Lord I wish! Mine is 1955 and it's right.Arrg crap.. I cant change it on the pc either..
Here is whats standing in the profile, but bet on that it allmost the same thing standig in your profile..
Date of Birth:
Jan 1, 1970
Once your birthday has been entered, it cannot be changed. Please contact an administrator if it is incorrect.
This is probably super-inefficient code. It's been the better part of a decade since i've written anything at all. Feel free to tidy it up. I tried to comment the shit out of it for clarity; for best results, remove all that crap once you understand what you're doing.
Lastly, as evidenced in my original post on this thread, i'm clearly AWFUL at even the simplest math, so as the Department of Homeland Security might say, "if you see something, say something."
signature_bar.php
PHP:<?php /* ******************************************************************************************** * x jeremy jarratt coded this terribly didn't he - http://jeremyjarratt.com/ - @transmothra * PRAISE DOBBS! HAIL ERIS! ALL HAIL DISCORDIA! * This work is licensed under the * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. ******************************************************************************************** */ // EDIT THESE NEXT FEW LINES // set your timezone or suffer the consequences date_default_timezone_set('America/New_York'); // set your quit date $quitdate = "2010-08-16"; // change this to your quit date // how much is a pack of smokes worth where you live? $cigprice = 5.00; // omit the dollar sign // how many packs per day did you smoke? $packsperday = 2.5; // decimals ok // how much do you spend on vaping per month? $vapecostmonthly = 30; // omit the dollar sign // set your font by filename - UPLOAD YOUR FONT FILE TO THE SAME DIRECTORY $font = './trebuc.ttf'; $fontb = './trebucbd.ttf'; // number of pixels for the left margin $left_margin = 5; // HEY LET'S CALCULATE A BUNCH OF CRAP (in general, leave this alone) $now = time(); // this is really NOW, for comparison to your quit date $your_date = strtotime($quitdate); $datediff = $now - $your_date; // compare your quit date to right now (output in seconds) $datetime1 = new DateTime($quitdate); $datetime2 = new DateTime(); $interval = date_diff($datetime1, $datetime2); // just another time comparison $howlong = $interval->format('%y years, %m months, %d days'); $vapedays = floor($datediff/(60*60*24)); // convert time since quitting to days (rounded down to eliminate any remainder) $vapecostdaily = $vapecostmonthly/30; // divide monthly cost by 30 for a daily cost $vapecost_ttl = $vapecostdaily*$vapedays; // multiply daily vape cost by total days since quitting $vapesaved = $vapedays*$cigprice*$packsperday-$vapecost_ttl; // days x cost x ppd, minus vaping costs $cigsavoided = $packsperday*20*$vapedays; // ppd x 20 smokes per pack x total days since quitting $packs = $cigsavoided/20; // total number of packs avoided since quitting // format numbers: decimal places, decimal separator, thousands separator $vapesaved = number_format($vapesaved, 2, '.', ','); $cigsavoided = number_format($cigsavoided, 0, '.', ','); $packs = number_format($packs, 0, '.', ','); $vapedays = number_format($vapedays, 0, '.', ','); // put in a bunch of quotes or whatever you want; space is limited!; rotated on a random basis $randomquote = array( 'The SubGenius must have SLACK! (B.Dobbs)', 'Hail Eris! All Hail Discordia!', 'How can I be free in the shadow of a chapel? (anon)', 'Act like a dumbshit and they\'ll treat you like an equal (B.Dobbs)', 'Nature abhors a moron. (HL Mencken)', 'Puritanism: The haunting fear that someone, somewhere, may be happy. (HL Mencken)', 'The highest understanding we can achieve: laughter & human compassion. (Feynman)', ); $quotation = $randomquote[rand(0, sizeof($randomquote) - 1)]; // DON'T EDIT UNLESS YOU KNOW WHAT YOU'RE DOING $image = 'signature_bar.png'; // create a banner image with this name; 468 pixels wide by 60 pixels tall $im = imagecreatefrompng($image); // set colors (RGB) $main_color = imagecolorallocate($im, 51, 102, 153); $black = imagecolorallocate($im, 0, 0, 0); $orange = imagecolorallocate($im, 255, 140, 0); $blue = imagecolorallocate($im, 216, 196, 255); $red = imagecolorallocate($im, 255, 0, 0); $green = imagecolorallocate($im, 0, 160, 0); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 216, 216, 216); $yellow = imagecolorallocate($im, 255, 216, 64); // THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text // Add the text - drop shadow imagettftext($im, 12, 0, $left_margin-2, 18, $black, $fontb, 'Vaping since 16 August 2010; '.$howlong); imagettftext($im, 10, 0, $left_margin-2, 34, $black, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs'); imagettftext($im, 10, 0, $left_margin-2, 50, $black, $font, 'Money spent on better things: $'.$vapesaved); imagettftext($im, 8, 0, $left_margin-1, 65, $black, $fontb, $quotation); // Add the text imagettftext($im, 12, 0, $left_margin, 16, $orange, $fontb, 'Vaping since 16 August 2010; '.$howlong); imagettftext($im, 10, 0, $left_margin, 32, $blue, $font, 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs'); imagettftext($im, 10, 0, $left_margin, 48, $white, $font, 'Money spent on better things: $'.$vapesaved); imagettftext($im, 8, 0, $left_margin, 64, $yellow, $fontb, $quotation); // LEAVE THESE ALONE DAMN YOU header('Content-Disposition: filename=signature_bar.png'); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?>
Thanks! I was going to tackle that very thing when i had the time. If you don't mind, i would love to see how you did it! I'm pretty sure i know exactly what you mean but i haven't actually tried it out yet.I mentioned in another thread that I may have a couple of suggestions. Well, I really only have one, other than whatever other do-dads people want to add to their own banners: instead of typing the shadow and highlight lines individually and doubling up on all that keyboard time (and possibly introducing weirdnesses between the shadow and highlight), assign the individual line messages to variables and just type the variables into the imagettftext() functions.
If you need an example, I'd be happy to post mine.
Thank you again for actually doing the research on this! I had no idea of that function, which makes all this possible!
// THE MESSAGE
$line1 = 'Vaping since 16 August 2010; '.$howlong;
$line2 = 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs';
$line3 = 'Money spent on better things: $'.$vapesaved.' + $'.$vapecost_ttl.' shamelessly vaporized';
// the spacing
$line1vert = 16;
$line2vert = 32;
$line3vert = 48;
$line4vert = 64;
// THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text
// Add the text - drop shadow
imagettftext($im, 12, 0, $left_margin-2, $line1vert+2, $black, $fontb, $line1);
imagettftext($im, 10, 0, $left_margin-2, $line2vert+2, $black, $fontb, $line2);
imagettftext($im, 9, 0, $left_margin-2, $line3vert+2, $black, $font, $line3);
imagettftext($im, 8, 0, $left_margin-1, $line4vert+2, $black, $fontb, $quotation);
// Add the text
imagettftext($im, 12, 0, $left_margin, $line1vert, $blue, $fontb, $line1);
imagettftext($im, 10, 0, $left_margin, $line2vert, -$cyan, $fontb, $line2);
imagettftext($im, 9, 0, $left_margin, $line3vert, -$white, $font, $line3);
imagettftext($im, 8, 0, $left_margin, $line4vert, -$cyan2, $fontb, $quotation);
Thanks! I was going to tackle that very thing when i had the time. If you don't mind, i would love to see how you did it! I'm pretty sure i know exactly what you mean but i haven't actually tried it out yet.
[EDIT] here's my attempt, though i'm sure this could be done far more efficiently somehow. I'm usually only able to code late at night after my job, so my brain is usually fairly frizzle-fried by then.
Code:// THE MESSAGE $line1 = 'Vaping since 16 August 2010; '.$howlong; $line2 = 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs'; $line3 = 'Money spent on better things: $'.$vapesaved.' + $'.$vapecost_ttl.' shamelessly vaporized'; // the spacing $line1vert = 16; $line2vert = 32; $line3vert = 48; $line4vert = 64; // THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text // Add the text - drop shadow imagettftext($im, 12, 0, $left_margin-2, $line1vert+2, $black, $fontb, $line1); imagettftext($im, 10, 0, $left_margin-2, $line2vert+2, $black, $fontb, $line2); imagettftext($im, 9, 0, $left_margin-2, $line3vert+2, $black, $font, $line3); imagettftext($im, 8, 0, $left_margin-1, $line4vert+2, $black, $fontb, $quotation); // Add the text imagettftext($im, 12, 0, $left_margin, $line1vert, $blue, $fontb, $line1); imagettftext($im, 10, 0, $left_margin, $line2vert, -$cyan, $fontb, $line2); imagettftext($im, 9, 0, $left_margin, $line3vert, -$white, $font, $line3); imagettftext($im, 8, 0, $left_margin, $line4vert, -$cyan2, $fontb, $quotation);
<?php
/*
********************************************************************************************
* x jeremy jarratt coded this terribly didn't he - http://jeremyjarratt.com/ - @transmothra
* PRAISE DOBBS! HAIL ERIS! ALL HAIL DISCORDIA!
* This work is licensed under the
* Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
********************************************************************************************
*/
// EDIT THESE NEXT FEW LINES
// set your timezone or suffer the consequences
date_default_timezone_set('America/New_York');
// set your quit date
$quitdate = "2010-08-16"; // change this to your quit date
// how much is a pack of smokes worth where you live?
$cigprice = 5.00; // omit the dollar sign
// how many packs per day did you smoke?
$packsperday = 2.5; // decimals ok
// how much do you spend on vaping per month?
$vapecostmonthly = 50; // omit the dollar sign
// set your font by filename - UPLOAD YOUR FONT FILE TO THE SAME DIRECTORY
$font = './trebuc.ttf';
$fontb = './trebucbd.ttf';
// number of pixels for the left margin
$left_margin = 5;
// HEY LET'S CALCULATE A BUNCH OF CRAP (in general, leave this alone)
$prettydate = date_create_from_format("Y-m-j", $quitdate); // no, not a girl/boy. just a nicer-looking date format.
$now = time(); // this is really NOW, for comparison to your quit date
$your_date = strtotime($quitdate);
$datediff = $now - $your_date; // compare your quit date to right now (output in seconds)
$datetime1 = new DateTime($quitdate);
$datetime2 = new DateTime();
$interval = date_diff($datetime1, $datetime2); // just another time comparison
$howlong = $interval->format('%y years, %m months, %d days');
$vapedays = floor($datediff/(60*60*24)); // convert time since quitting to days (rounded down to eliminate any remainder)
$vapecostdaily = $vapecostmonthly/30; // divide monthly cost by 30 for a daily cost
$vapecost_ttl = $vapecostdaily*$vapedays; // multiply daily vape cost by total days since quitting
$vapesaved = $vapedays*$cigprice*$packsperday-$vapecost_ttl; // days x cost x ppd, minus vaping costs
$cigsavoided = $packsperday*20*$vapedays; // ppd x 20 smokes per pack x total days since quitting
$packs = $cigsavoided/20; // total number of packs avoided since quitting
// format numbers: decimal places, decimal separator, thousands separator
$vapesaved = number_format($vapesaved, 2, '.', ',');
$vapecost_ttl = number_format($vapecost_ttl, 2, '.', ',');
$cigsavoided = number_format($cigsavoided, 0, '.', ',');
$packs = number_format($packs, 0, '.', ',');
$vapedays = number_format($vapedays, 0, '.', ',');
// put in a bunch of quotes or whatever you want; space is limited!; rotated on a random basis
$randomquote = array(
'How can I be free in the shadow of a chapel? (anon)',
'We are a way for the cosmos to know itself. (C.Sagan)',
'What can be asserted w/o evidence can also be dismissed w/o evidence. (C.Hitchens)',
'I\'d take the awe of understanding over the awe of ignorance any day. (D.Adams)',
'I love deadlines. I love the whooshing noise they make as they go by. (D.Adams)',
'DON\'T PANIC (D.Adams)',
'Nothing is true. Everything is permissible. (Hassan i Sabbah)',
'We are made of starstuff. (C.Sagan)',
'Curb Your Dogma. (Hill/Thornley)',
'The Enlightened take things Lightly. (Hill/Thornley)',
'Ideologies separate us. Dreams and anguish bring us together. (Ionesco)',
'Anyone who isn\'t confused doesn\'t really understand the situation. (E.Murrow)',
'As for me, all I know is that I know nothing. (Socrates)',
'Only the madman is absolutely sure. (RA Wilson)',
'A frog in a well cannot conceive of the ocean. (Zhuangzi)',
'With our thoughts we make the world. (Gotama)',
'Oppressive laws don\'t destroy minorities; they simply make bootleggers. (HL Mencken)',
'Nature abhors a moron. (HL Mencken)',
'Puritanism: The haunting fear that someone, somewhere, may be happy. (HL Mencken)',
'The highest understanding we can achieve: laughter & human compassion. (Feynman)',
);
$quotation = $randomquote[rand(0, sizeof($randomquote) - 1)];
// DON'T EDIT UNLESS YOU KNOW WHAT YOU'RE DOING
$image = 'signature_bar.png'; // create a banner image with this name; 468 pixels wide by 60 pixels tall
$im = imagecreatefrompng($image);
// set colors (RGB)
$main_color = imagecolorallocate($im, 51, 102, 153);
$black = imagecolorallocate($im, 0, 0, 0);
$orange = imagecolorallocate($im, 255, 180, 90);
$blue = imagecolorallocate($im, 180, 200, 255);
$cyan = imagecolorallocate($im, 200, 215, 255);
$cyan2 = imagecolorallocate($im, 215, 235, 255);
$red = imagecolorallocate($im, 255, 0, 0);
$green = imagecolorallocate($im, 0, 160, 0);
$white = imagecolorallocate($im, 235, 235, 255);
$grey = imagecolorallocate($im, 216, 216, 216);
$yellow = imagecolorallocate($im, 255, 216, 64);
/* OUTPUT FOR TESTING/DEBUGGING - TO TEST, COMMENT OUT EVERYTHING BELOW THIS BLOCK TO THE END
echo "now = ".$now."<br>".
"quitdate = ".$quitdate."<br>".
"your_date = ".$your_date."<br>".
"datediff = ".$datediff."<br>".
"howlong = ".$howlong."<br>".
"vapedays = ".$vapedays."<br>".
"vapesaved = ".$vapesaved."<br>".
"cigsavoided = ".$cigsavoided."<br>".
"packs = ".$packs."<br>"
;
*/
// THE MESSAGE
$line1 = 'Vaping since '.$prettydate->format('j F Y').'; '.$howlong;
$line2 = 'Cigarettes avoided: '.$cigsavoided.' in '.$packs.' packs';
$line3 = 'Money spent on better things: $'.$vapesaved.' + $'.$vapecost_ttl.' shamelessly vaporized';
// the spacing
$line1vert = 16;
$line2vert = 32;
$line3vert = 48;
$line4vert = 64;
// THE MAGIC: set font size, font angle, horizontal position, vertical position, color, fontface, text
// Add the text - drop shadow
imagettftext($im, 12, 0, $left_margin-2, $line1vert+2, $black, $fontb, $line1);
imagettftext($im, 10, 0, $left_margin-2, $line2vert+2, $black, $fontb, $line2);
imagettftext($im, 9, 0, $left_margin-2, $line3vert+2, $black, $font, $line3);
imagettftext($im, 8, 0, $left_margin-1, $line4vert+2, $black, $fontb, $quotation);
// Add the text
imagettftext($im, 12, 0, $left_margin, $line1vert, $blue, $fontb, $line1);
imagettftext($im, 10, 0, $left_margin, $line2vert, -$cyan, $fontb, $line2);
imagettftext($im, 9, 0, $left_margin, $line3vert, -$white, $font, $line3);
imagettftext($im, 8, 0, $left_margin, $line4vert, -$cyan2, $fontb, $quotation);
// LEAVE THESE ALONE DAMN YOU
header('Content-Disposition: filename=signature_bar.png');
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
Wow, i honestly thought i was the only person ever who knew a little bit of PHP yet didn't know any JavaScript! Now i don't feel quite so alone.I'm sure I could learn, but I don't know any Javascript, if it's similar to that. I only know enough PHP to get me in trouble.
Wow, i honestly thought i was the only person ever who knew a little bit of PHP yet didn't know any JavaScript! Now i don't feel quite so alone.
phpBB - wow. That brings back some memories. I ran several boards with that, years back. Good stuff. I actually went to check up on them a little while back and they're apparently STILL on v2. Seems they've stalled or something, or maybe they've just been super micro-incremental for the past ten fucking years.Funny!
I'm not quite finished with my first beginner's PHP & MySQL book, and I only knew what I did before that from running a bunch of phpBB and vBulletin fora.
I decided that I'd like to actually learn PHP and MySQL, so I picked up a couple of Kindle books.
I only made my initial suggestion because I made sure to check and double-check those lines before realizing I should combine them into one variable.
For a couple of years there my nightmares actually had code delimiters at the beginning and end.When I have nightmares it's always in zero's & Ones.