Activity Stream
48,167 MEMBERS
62701 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3
  1.     
    #1
    Member

    Default Tutorials: Creating Images with PHP

    The fundamentals of creating an image in PHP using GD Library support. This tutorial shows you how to create a simple image with welcome text and a name to follow.

    Cooper Reviewed by Cooper on . Tutorials: Creating Images with PHP The fundamentals of creating an image in PHP using GD Library support. This tutorial shows you how to create a simple image with welcome text and a name to follow. YGHL5i0Fnnw Rating: 5
    Removed by staff. Do not add the image again or we may infract you. We do not condone members to create protests.But But But what about freedom of speech. <-- that's a myth that exists in developed countries.

  2.   Sponsored Links

  3.     
    #2
    Respected Developer
    Website's:
    wrzc.org
    I made this for Hawk a few months ago. Some may find it useful

    PHP Code: 
    <?php
    /* 
    Download for instructions and how to use...
    http://rapidshare.com/files/400777995/php-image.zip
    */

    // lets get the text to display
    if (isset($_GET['id'])) {
        
    $text $_GET['id'];
    }
    // here you can put the default message if their's an error displaying the one in the url.
    else { $text "Default message here";}

    // This is the default background image. Like a template without the text showing on it.
    $bg "bg/default.jpg";
    // obvious enough. Change the size. It's height is in pixels.
    $size "30";
    // just enter the hex color you want. You can use something like http://www.2createawebsite.com/build/hex-colors.html to get the color you want.
    $color "A03B3B";
    // change the path to where you upload the font. It has to be .ttf but you can google and find which ever suits.
    $font "font/arial.ttf";


    $im imagecreatefromjpeg($bg);
    Header("Content-type: image/png");

    // This convert the hex color to RGB
    $color imagecolorallocate($imhexdec('0x' $color{0} . $color{1}), hexdec('0x' $color{2} . $color{3}), hexdec('0x' $color{4} . $color{5}));

    //------ this is a fancy bit you can use if you want the text centered --------
    for(;;){
        
    // just change the figures below to where you want the exact center point of the text to be from the top left corner
        
    $image_width '400';
        
    $image_height '62';
        list(
    $left_x$bottom_y$right_x, , , $top_y) = imagettfbbox($size0$font$text); 
        
    $text_width $right_x $left_x;
        
    $text_height $top_y $bottom_y
        if(
    $image_width $text_width+5){
            break;
        }

        
    $size $size .5
        if(
    $size == 1){ 
            die(
    'Script not responding to decreasing font size, in other words: try using less letters.'); 
        } 

    $hpadding = ($image_width $text_width)/2
    $vpadding = ($image_height $text_height)/2;

    //-------- End of fancy centered text bit, Delete it all if you don't want it --------

    // If you not using and have deleted the fancy centered bit above you can uncomment the below two lines to put where you want to give the location of the text.
    // $hpadding = '200';
    // $vpadding = '100';

    // Next we add the text
    // FORMAT IS: image, size, angle, x distance, y distance, color, font, text string
    imagettftext($im$size0$hpadding$vpadding$color$font$text);

    imagepng($im);
    imagedestroy($im);
    ?>
    It might by an idea to stripslashes() or mysql_real_escape_string() the $_GET for security depending on how or where your using it.

    Download it all here http://rapidshare.com/files/400777995/php-image.zip
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

  4.     
    #3
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    Hate people who use for(;{ lool use while(true){

    Nice little post tho MrH
    Join Litewarez.net today and become apart of the community.
    Unique | Clean | Advanced (All with you in mind)
    Downloads | Webmasters


    Notifications,Forum,Chat,Community all at Litewarez Webmasters


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Broken Images overlapping New Images
    By Leeds in forum vBulletin
    Replies: 8
    Last Post: 17th Apr 2012, 08:57 PM
  2. SEO Tutorials - Tutorials for new webmasters
    By Profit in forum Tutorials and Guides
    Replies: 16
    Last Post: 9th Dec 2011, 06:52 AM
  3. Replies: 11
    Last Post: 11th Feb 2011, 11:58 PM
  4. Creating forum signature tutorials?
    By Daniel in forum Graphics Area
    Replies: 14
    Last Post: 29th Sep 2010, 11:50 PM
  5. Images Watermarker of my Images and Upload it!!
    By Bytes in forum Completed Transactions
    Replies: 11
    Last Post: 5th Aug 2010, 11:24 AM

Tags for this Thread

BE SOCIAL