www.webdeveloper.com
Results 1 to 6 of 6

Thread: Image Editing

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    87

    Image Editing

    hi, i have a image which i want to overlay dynamic text and then save it as a .png or .gif how would i go about, ive had alook round php.net but not sure what to search for, example below

    PHP Code:
    $img 'test.png';
    $text =  'Created by '.$name
    PHP:4,5

    Thanks

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    Quote Originally Posted by gavshouse View Post
    hi, i have a image which i want to overlay dynamic text and then save it as a .png or .gif how would i go about, ive had alook round php.net but not sure what to search for, example below

    PHP Code:
    $img 'test.png';
    $text =  'Created by '.$name
    PHP:4,5

    Thanks
    Assuming you compiled PHP with GD support, you can use the GD2 functions.

  3. #3
    Join Date
    Feb 2008
    Posts
    87
    ive looked into that but i cant find a function that will write text on a image, just to create a image with text

  4. #4
    Join Date
    Feb 2008
    Posts
    87
    ive found what i want but i get a error, whats the full path to the font file ive tried this but i get that error.

    PHP Code:
    $font imagepsloadfont($_SERVER['DOCUMENT_ROOT'].'/font.pfm'); 
    PHP Code:
    Fatal errorCall to undefined function imagepsloadfont() in /home/fhlinux159/p/ps3.gavssite.com/user/htdocs/test/test.php on line 11 
    Full Code
    PHP Code:
    <?php
    // Create image handle
    $im imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].'/test/test.png');

    // Allocate colors
    $black imagecolorallocate($im000);
    $white imagecolorallocate($im255255255);

    // Load the PostScript Font
    $font imagepsloadfont($_SERVER['DOCUMENT_ROOT'].'/font.pfm');

    // Write the font to the image
    imagepstext($im'Sample text is simple'$font12$black$white5050);

    // Output and free memory
    header('Content-type: image/png');

    imagepng($im);
    imagedestroy($im);
    ?>
    im using this http://uk2.php.net/manual/en/functio...atefrompng.php

  5. #5
    Join Date
    Feb 2008
    Posts
    87

    imagepsloadfont() Problems

    im having problems with this GD function

    for full story and code refer to my previous post
    http://www.webdeveloper.com/forum/sh...d.php?p=967144

    code snippet
    PHP Code:
    <?php
    // Create image handle
    $im imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].'/test/test.png');

    // Allocate colors
    $black imagecolorallocate($im000);
    $white imagecolorallocate($im255255255);

    // Load the PostScript Font
    $font imagepsloadfont($_SERVER['DOCUMENT_ROOT'].'/font.pfm');

    // Write the font to the image
    imagepstext($im'Sample text is simple'$font12$black$white5050);

    // Output and free memory
    header('Content-type: image/png');

    imagepng($im);
    imagedestroy($im);
    ?>
    Documentation
    http://uk2.php.net/manual/en/functio...atefrompng.php

  6. #6
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    please do not repost threads if you haven't had it resolved. we don't discourage bumping.

    anyways, I think you should look at this link, since your error is with loading fonts

    http://uk2.php.net/manual/en/functio...psloadfont.php

    specifically this note:

    Note: This function is only available if PHP is compiled using --with-t1lib[=DIR].
    Did you in fact compile php with t1lib?
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles