1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Help please...

Discussion in 'Software Development' started by teepeeee, May 2, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    Hi everyone.
    I'm new to the forums and have a question I'm hoping someone could help me out with please.
    I would like to make these:

    [​IMG]

    Now I know how to make the graphics but how does this person get the numbers to change to correspond with the date?

    please help
    thank you

    J
     
  2. andythepandy

    andythepandy

    Joined:
    Jul 2, 2006
    Messages:
    379
    The way those images are made is with PHP. I could post an example if you want or you could google 'php add text to image' or something like that.

    Hope that's what you want,
    Andy
     
  3. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    Thanks, yes it looks like.

    What program will I need to do it? Where is the image hosted? I do all my images in CS4.
    Do you know of an easy tut as I'm a novice at code and such but really want to learn to do this...
     
  4. andythepandy

    andythepandy

    Joined:
    Jul 2, 2006
    Messages:
    379
    Well first of all, the most important thing is, where is the image going to be.
    If it's going to be on a website, have you got and website that you can upload files to?
    If you're going to have it in your documents, the method I first suggested won't work.

    Andy
     
  5. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    They will be displayed in peoples signatures on a forum.
    I already do signatures but want to incorporate these 'age tickers' into them.
    Currently I use CS4 to create the ticker then host on Photobucket.
    My partners website is hosted on heart internet which I have access to if I need to host them on the web.
     
  6. andythepandy

    andythepandy

    Joined:
    Jul 2, 2006
    Messages:
    379
    Save this as whatever.php
    PHP:
    <?php
    date_default_timezone_set
    ('UTC');
    header('content-type: image/png');     //tells the browser that we are looking at an image
    $today mktime();            //gets the date now
    $bornon mktime(0001151998);    //the born on date, in format mktime(0, 0, 0, month, day, year)
    $diff = ($today $bornon);        //gets the difference between today and $bornon

    $years floor($diff/(60*60*24*365));    
    $months floor( ($diff - ($years * (60*60*24*365)))/(60*60*24*(365/12)));
    $days floor(($diff - ($years * (60*60*24*365)) - ($months * (60*60*24*(365/12))))/(60*60*24));

    $str sprintf("%s years, %s months and %s days old!",$years$months$days); 


    $file 'C:/images/image.png';                     //path to background image file (put the path to the background image here)
    $img imagecreatefrompng($file)            //create new image from existing image 

    imagestring($img55010"Born On: " date('j.n.Y'$bornon) , imagecolorallocate($img000));    
    imagestring($img55050$strimagecolorallocate($img000));
    imagepng($img);
    imagedestroy($img);

    ?>
    This code, with the replacement of the image path, should create a image of the background image with the text overlayed.
    To change the positioning of the text, change the underlined values below(they mean x-position and y-position)
    Code:
    magestring($img, 5,[U]50, 10,[/U] 
    
    This will have to be hosted on the web

    p.s.
    This will use a standard font which will look a bit off. Post back if you want to use a different font.

    Good Luck!!!
     
  7. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    ok, I shall have a go and let you know how I did!
    Thanks.
     
  8. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    sorry, quick question but where do i put the IMG code on there?
     
  9. teepeeee

    teepeeee Thread Starter

    Joined:
    May 2, 2010
    Messages:
    6
    its ok, Ive read it properly (doh)

    Do i then need to upload that document to the web server?
     
  10. andythepandy

    andythepandy

    Joined:
    Jul 2, 2006
    Messages:
    379
    Yes, upload that to the server.
     
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Help please
  1. charlzguitarz
    Replies:
    4
    Views:
    952
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/920552

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice