Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: images and php

  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts

    images and php

    Hello,

    I have an image using the:

    Code:
    <img src="">
    standard image html notation. How would I create an image that displayed text echoed using php. For example I would like the result of:

    PHP Code:
    echo "hello world" 
    to be displayed on my image??

    thanks

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I found this code on a website to write a string on an image. Is there a PHP function which accepts parameters such as picture.jpg instead of values as with "imagecreate(100, 30)" or another way to use an image i have created in photoshop. The way you suggested i didnt think gave much control over the look of the button for a novice.

    Code:
    <?php
    // create a 100*30 image
    $im = imagecreate(100, 30);
    
    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 255);
    
    // write the string at the top left
    imagestring($im, 5, 0, 0, "Hello world!", $textcolor);
    
    // output the image
    header("Content-type: image/png");
    imagepng($im);
    ?>


  •  

    Posting Permissions

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