Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Text to image script? Help...

  1. #1
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text to image script? Help...

    Would like to have a script that allows my customers to preview text on a certain product for personalizing. If anyone has any ideas on this, I would greatly appreciate their help.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,740
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    could you describe a little more what you are asking for?
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    yes. the picutre is here: http://www.4akiss.com/silvergoldlarge.jpg

    I would like to place the text in the lower area of the box. Would like for customers to pick their text as well. I really appreciate your help.

  5. #5
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Just seen where you helped out another person with the same question. She needed exactly what I need. Here is the post: http://www.dynamicdrive.com/forums/s...ad.php?t=36481

    The website there does not work though.

  6. #6
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

  7. #7
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Because Im an idiot, I still need help. I put the code on my site, but it doesnt seem to be working. If you can, please check it out and tell me what Im doing wrong.
    http://www.4akiss.com/test.htm

    Thank you so much!

  8. #8
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Make a file called "makeIt.php" and in it, put the following code:
    Code:
    <?php
    $imageExt = "?colorData1=".$_POST['lineCA']."&textData1=".$_POST['lineTA'];
    $imageExt .= "&colorData2=".$_POST['lineCB']."&textData2=".$_POST['lineTB'];
    $imageExt .= "&colorData3=".$_POST['lineCC']."&textData3=".$_POST['lineTC'];
    $imageExt .= "&colorData4=".$_POST['lineCD']."&textData4=".$_POST['lineTD'];
    $imageExt .= "&colorData5=".$_POST['lineCE']."&textData5=".$_POST['lineTE'];
    echo "render.php".$imageExt;
    ?>
    Jeremy | jfein.net

  9. #9
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, now I might be annoying you by this point, but I would like to have instead of the hex area, a drop down menu with the option of text, text color, and set the number of letters used in the text area to 20. And can I change the image to what I want? Do I have to change the php files any to use my picture wich is a .jpg?

  10. #10
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    If you want to change the image type, open up render.php and change it to the following code:
    PHP Code:
    <?php
    $amount 
    5//How many lines allowed?
    $imageSRC "CHANGETHIS.jpeg"//Image, gif
    $imageFont "Maian.TTF";
    //header("Content-type: image/jpeg"); //Header: gif
    $image imagecreatefromjpeg($imageSRC); //create from gif
    function hex2rgb($hex){
      global 
    $image;
      if(
    strlen($hex) == 3)
        
    $hex $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
      if(
    strlen($hex) == 6){
        
    $red hexdec(substr($hex02));
        
    $green hexdec(substr($hex22));
        
    $blue hexdec(substr($hex42));
      }
      return 
    imagecolorallocate($image$red$green$blue);
    }
    for(
    $i 1$a 65$i <= $amount$i++){
      
    $getData_color[$i] = trim($_GET['colorData'.$i]); //decode, and store color
      
    $getData_text[$i] = trim($_GET['textData'.$i]);
        
    $a += 15;
        
    imagettftext($image12075$ahex2rgb($getData_color[$i]), $imageFont$getData_text[$i]);
    }
    imagejpeg($image);
    imagedestory($image);
    ?>
    Now, to make the color a dropdown, in your HTML where the hex input is, simply change that to a <select> with the same name and ID of the hex input you changed. Each value should have a value of the hex you want the color to be. For example, black would be #000, white would be #fff, blue woud be 0000ff. If you were to be changing line A, you would make it look something like:
    Code:
    <tr><td><label for="lineA">Line 1:</label></td><td><input type="text" id="lineA" name="lineTA" onkeyup="makePicture();"/></td><td>
    <select name="lineCA" id="lineCA" onchange="makePicture();">
    	<option value="000">Black</option>
    	<option value="FFF">White</option>
    	<option value="0000ff">Blue</option>
    </select></td></tr>
    Notice: -highlighted you must keep the same (except A in id/name, change that depending on the row it is).
    -bold+red the value of the option must be a hex, it can't be simply "blue"

    Ask more questions if you still need help - I will not be annoyed
    Jeremy | jfein.net

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
  •