Results 1 to 4 of 4

Thread: PHP Timer Image

  1. #1
    Join Date
    Jul 2011
    Posts
    56
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default PHP Timer Image

    Have you seen those square icon images sometimes in game that have a what looks like a slice was cut out of it to represent the amount of time left? Is it possible to do that with PHP and if so, how would I go about doing that?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    At least for me, your question is unclear. Are you talking about a pie chart (although it would be a simple one)?

    Regardless of the details of the graphics, this isn't really one of the main things that PHP can do. There are a few issues:

    1. PHP doesn't by default make graphics. In fact, it actually can make images using the GD library or the imagemagick extension, but they're a little hard to work with and can take some time to process, so if you want something basic they can probably do it.

    2. What do you want the output format to be? Do you want an image? Or could this be designed using CSS? You could use PHP to generate dynamic CSS so you could change the width of something, for example. A box within a box (probably divs) might be what you're looking for.

    3. PHP won't be "like a game" because it must work on the server. If you need this to be interactive, then you'd need to use Javascript (or maybe Flash).

    Anyway, please give some more information, try to post an image of what you're talking about, and also explain how you intend to use it (does it need to interact with the user?).
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2011
    Posts
    56
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default

    Yes it is like a pie chart but only square and I only need it to be over an image so it might use CSS for the opacity part. But besides that all I need is a square pie chart. If you want an image example, put this in your URL box.

    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAWklEQVRYhe3OkRICUQBA0fMRUZgka9FKtJgki0mytpYkfXo/8Sbpnpnrl7E+A2usscYaa6yxxhprrLHfjL3xwo4NTzyw4o4bFlwx44IJZ5xwxGH0WJIkSfKnvjY8sI5OGOfuAAAAAElFTkSuQmCC

    You should see a gray looking shape. Now all I need is a PHP script that will generate that.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    What about interaction? Does it need to change?

    I still recommend using HTML to make this. You can generate it (eg, percentage widths) with PHP, but then you don't need to deal with an image. And if needed, you can use Javascript to make this image change dynamically/interactively.

    You can make an image if you'd like, though. Just look into the GD library. Make an image (whatever background color you want); add a rectangle of the right dimensions; generate the image. That is so small that it shouldn't take much processing power or be very slow, although I wouldn't recommend having thousands of users generating it at the same time-- if it would be more efficient, you could cache the image (only if you'll be using the same image many times).

    You should also think about why you're not just making this image in your graphics program-- if you explain that, I might be able to give more advice. But it's your choice, of course.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •