Jump to content
#StayAtHome ×


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About DogMan

  • Rank
  1. Hi. Appologies for being quite daft. I studied about a year of python, some C++ [little] but it was a/ not php and b/ really only command line stuff. A friend asked if I could help with something for a project, it should be easy,but my scripting brain has not been exercised recently and I am struggling. The aim is a signature banner for forums, that has a background image with logo, and overlaid on that, text which tracks X Years, X months, X days since quitting smoking. Similar to this,but with the NNA AU logo. And without so much detail. http://nicoticket.x10.mx/1374944400_12_1000_sepia_U I want it to take an argument from the url, so people can use their own quit date, and use that to generate the text. I borrowed some of this code, with a fixed date I'm probably way off, but googling lead me to believe the $_GET function is what I use to get a url argument? I think my syntax is wrong though <?PHP /* ******************************************************************************************** * Heavily edited by DogMan of Vaper Cafe Australia ******************************************************************************************** */ // EDIT THESE NEXT FEW LINES // set your timezone or suffer the consequences date_default_timezone_set('Australia/Melbourne'); // set your quit date $_GET ['quitdate']; // need url argument of quit date // 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) // format numbers: decimal places, decimal separator, thousands separator $vapedays = number_format($vapedays, 0, '.', ','); // 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 imagettftext($im, 12, 0, $left_margin, 16, $black, 'Vaping for: '.$howlong);// LEAVE THESE ALONE DAMN YOU header('Content-Disposition: filename=signature_bar.png'); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Thanks for any help, and again, sorry to barge in and ask for help, and be so daft and out of practice
  2. DogMan


    Hi, I am human, Dan, From Australia. I did a bit of study a few years back, mostly in python. Have a few things I'm trying to do in php, which I will start threads for. Anyhoo, just introducing myself as not to be rude
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.