Results 1 to 10 of 10

Thread: [php]my arrays arent apearing on my image :(

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default [php]my arrays arent apearing on my image :(

    here is my code:
    Code:
    <?php
    
      $b = file_get_contents("Theive_RSC.txt");
      $array = explode(";", $b);
    
    
      header("Content-type: image/png");
    
      function create(){
    
        $im = imagecreate(275, 60);
    
        $bg = imagecolorallocate($im, 138, 138, 138);
        $textcolor = imagecolorallocate($im, 255, 0, 0);
    
        imagestring($im, 3, 0, 0, "Awkward Thiever!", $textcolor);
        imagestring($im, 3, 0, 15, "Total sleeps: " . $array[0], $textcolor);
        imagestring($im, 3, 0, 30, "Total Fights: " . $array[1], $textcolor);
        imagestring($im, 3, 0, 45, "Total PickPockets: " . $array[2], $textcolor);
        imagepng($im);
        imagedestroy($im);
      }
      create();
    ?>
    and the image:


    the "array" values should be a string, and they should have actual values, since the value in the .txt is:
    Code:
    13;84;221
    it is also chmod 777

    what do
    Last edited by Awkwardsaw; 11-25-2009 at 09:52 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    could it be that http://akwardsaw.hostoi.com/Theive_RSC.txt is empty?

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    thats odd =o

    it doesnt say its empty when i edit/ veiw it, but when i open the actual webpage its empty
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Nov 2007
    Location
    lol
    Posts
    176
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    thats odd =o

    it doesnt say its empty when i edit/ veiw it, but when i open the actual webpage its empty


    here is a demo changed colours in example

    http://www.phpcreation.nl/Theive_RSC.txt

    code

    PHP Code:
    <?php 

    header
    ("Content-type: image/png");

    function 
    create(){

    $string file_get_contents("Theive_RSC.txt");
    $array explode(";"$string); 

    $im imagecreate(27560); 
    $bg imagecolorallocate($im138138138);
    $textcolor imagecolorallocate($im25500);

        
    imagestring($im300"Awkward Thiever!"$textcolor);
        
    imagestring($im3015"Total sleeps: " $array[0], $textcolor);
        
    imagestring($im3030"Total Fights: " $array[1], $textcolor);
        
    imagestring($im3045"Total PickPockets: " $array[2], $textcolor);

    imagepng($im);
    imagedestroy($im);
    }

    create();
    ?>
    $string = file_get_contents("Theive_RSC.txt");
    $array = explode(";", $string);

    has to be inside your function.
    Last edited by wesleyxD; 11-26-2009 at 07:14 PM.

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    <33 thanks! one more thing i know now about PHP
    Last edited by Awkwardsaw; 11-26-2009 at 08:00 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    It's thinggggggg You keep doing that
    Ce ne sont que des gueux


  7. #7
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    It's thinggggggg You keep doing that
    wat?

    e: o lol... i dont know how
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  8. #8
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Little offtopic,

    I used a MySQL database for my script signatures.

    SCAR > PHP
    PHP > MYSQL
    PHP > IMAGE



    Like that :P

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by rogeruk View Post
    Little offtopic,

    I used a MySQL database for my script signatures.

    SCAR > PHP
    PHP > MYSQL
    PHP > IMAGE



    Like that :P
    i was thinking about using a db, but im still trying to learn file stuff
    honestly, this works just as fine, the mysql might just be more organised
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    Nov 2007
    Location
    lol
    Posts
    176
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    i was thinking about using a db, but im still trying to learn file stuff
    honestly, this works just as fine, the mysql might just be more organised
    i can help you if you want just pm me if you need any help.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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