Results 1 to 4 of 4

Thread: PHP Image Generation

  1. #1
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Question PHP Image Generation

    Hello all!
    I was just wondering how DD had it's "RSS Button maker" and the "Gradent image" tool was made. I did a google search and got a few results, but non actually showing how you program this. Does anyone know a script\website that can explain how to do this (Or maybe you know??).
    Thanks,
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Check out the GD image functions from the php documentation:

    http://www.php.net/manual/en/ref.image.php

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Thanks, but one more question:
    I am using this script from php.net:
    Code:
    <?php
    function LoadPNG($imgname)
    {
        $im = @imagecreatefrompng($imgname); /* Attempt to open */
        if (!$im) { /* See if it failed */
            $im  = imagecreatetruecolor(150, 30); /* Create a blank image */
            $bgc = imagecolorallocate($im, 255, 255, 255);
            $tc  = imagecolorallocate($im, 0, 0, 0);
            imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
            /* Output an errmsg */
            imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
        }
        return $im;
    }
    header("Content-Type: image/png");
    $img = LoadPNG("bogus.image");
    imagepng($img);
    ?>
    and I want to write text ontop of the image that I imported. How can I do this? Also, could ths work as "Dynamic Text" such as change it to a certain uploaded font or automaticly add a filter to the text, e.g. shadow, glow etc?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

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

    Default

    Generally look through the functions on that page and take some time to get used to them. The explanations are complex and tedious, but generally the GD library is a pain anyway-- lots of potential, but awkward to use, and it also is very slow and taxing on the server.

    imagestring() writes text.

    As for a glow, that's getting more complex. You can try to calculate one yourself or use one of the built in filters with imagefilter().
    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
  •