Working With Images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Working With Images

    Ok, I am really getting into creating images from php.
    I want to make a script where by people can create their own 'designer wallpaper'.

    Here is a simple script that will let you use fonts in your text.

    Code:
    <?php
      Header("Content-type: image/gif");
      if(!isset($s)) $s=11;
      $size = imagettfbbox($s,0,"/$font",$text);
      $dx = abs($size[2]-$size[0]);
      $dy = abs($size[5]-$size[3]);
      $xpad=15;
      $ypad=15;
      $im =imagecreate($dx+$xpad,$dy+$ypad);
      $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); //background
      $black = ImageColorAllocate($im, 0,0,0);//outline
      $white = ImageColorAllocate($im, 255,255,255); //text colour
      ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
      ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
      ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/$font", $text);
      ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/$font", $text);
      ImageGif($im);
      ImageDestroy($im);
    ?>
    Just add some fonts in the same DIR as this script.
    Now link to ThisFile.php?text=SomeText&font=Somefont.ttf

    But how do we add a picture into this script?
    So that we can edit some picture.gif to make our wallpaper.

    #2
    Nice question....
    You can use GD functions...

    To edit a GIF image , use imagecreatefromGIF(filename); function.
    To edit a JPEG image , use imagecreatefromJPEG(filename); function.
    To edit a PNG image , use imagecreatefromPNG(filename); function.
    To edit a WBMP image , use imagecreatefromWBMP(filename); function.
    To edit a GIF image , use imagecreatefromgif(filename); function.


    You can also find an image from a string and edit it with,
    Code:
    imagecreatefromSTRING(stringvar);
    .

    Also , Good-Luck k: for your imagecreating script.
    Hope you share it with us.

    Comment


      #3
      imagecreatefromjpeg(PHP 3>= 3.0.16, PHP 4 >= 4.0.0)
      Create a new image from file or URL
      resource imagecreatefromjpeg ( string filename) \linebreak
      imagecreatefromjpeg() returns an image identifier representing the image obtained from the given
      filename.
      imagecreatefromjpeg() returns an empty string on failure. It also outputs an error message, which
      unfortunately displays as a broken link in a browser. To ease debugging the following example will
      produce an error JPEG:
      Example 1. Example to handle an error during creation (courtesy vic@zymsys.com )
      Code:
      function LoadJpeg ($imgname) {
      $im = @imagecreatefromjpeg ($imgname); /* Attempt to open */
      if (!$im) { /* See if it failed */
      $im = imagecreate (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;
      }
      = = = = =
      The more you laugh...the longer you live.
      Read more jokes at
      http://fun-files.co.cc

      Comment


        #4
        http://topsite.6te.net/always.wml

        a test bro not sure how to make that soon work on it
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          Nice question....

          Also , Good-Luck k: for your imagecreating script.
          Hope you share it with us. [/b]
          Yes of course.

          Comment


            #6
            man cool ,just huury , to share it with us k:

            Comment


              #7
              good.

              Comment


                #8
                you mean something like this
                http://kralj.up.md/logomaker/logomaker_en.php

                Comment


                  #9
                  Im also trying to do a script like that but strugling...

                  Click here!!!

                  Comment

                  Working...
                  X