Results 1 to 18 of 18

Thread: PHP GD

  1. #1

    PHP GD

    Hello,

    PHP Code:
    <?php
    $im 
    = @ ImageCreate 150100)
    or die ( 
    "Cannot create a new GD image.");
    $background_color ImageColorAllocate ($im255255255);
    $text_color ImageColorAllocate ($im2331491);
    ImageString ($im155"A Simple Text String"$text_color );
    header ("Content-type: image/png");
    ImagePng ($im);
    ?>
    That is the file source, but it always say
    Code:
    The image “http://dedicatedot.no-ip.info/sig/sig.png” cannot be displayed, because it contains errors.
    But on my local Windows Apache, it works just fine. Please help! Thank you!

  2. #2
    Join Date
    Mar 2008
    Posts
    1,717
    Remove the @ - it might be you don't have gd installed, or some other reason it's failing, but you'll never know because the @ operator is squelching the error log.
    I used to run the oldest commercial Mumble host.

  3. #3
    PHP Code:
    <?php
    header 
    ("Content-type: image/png");
    $im ImageCreate 150100);
    $background_color ImageColorAllocate ($im255255255);
    $text_color ImageColorAllocate ($im2331491);
    ImageString ($im155"A Simple Text String"$text_color );
    ImagePng ($im);
    ?>
    I changed to that now, and still same problem.
    And I do have gd installed according to phpinfo. Take a look.

  4. #4
    Have you tried pressing f5?

  5. #5
    Yea I refreshed many times. It works fine on my local windows machine. But the server is a Linux box...

  6. #6
    Works fine when I upload that script to my website. Can you get any GD code at all to work? Maybe try imagettftext or some other function instead of imagestring?

  7. #7
    how do I reinstall my GD?

  8. #8

  9. #9
    How do I reinstall apache without restarting SQL? I have a game server using the SQL database and I would prefer not to restart SQL.

  10. #10
    Join Date
    Jul 2009
    Location
    Charlotte, NC
    Posts
    42
    You should not need to touch MySQL at all.

    If you're using CentOS, you can install gd/php-gd with:
    yum install php-gd

  11. #11
    It's Ubuntu. Yum didn't work.

  12. #12
    Join Date
    Jul 2009
    Location
    Charlotte, NC
    Posts
    42
    Quote Originally Posted by DedicatedOT View Post
    It's Ubuntu. Yum didn't work.
    You'll need to use apt-get then:
    apt-get install php5-gd

  13. #13
    Code:
    [email protected]:~# apt-get install php5-gd
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    php5-gd is already the newest version.
    php5-gd set to manually installed.
    The following packages were automatically installed and are no longer required:
      libboost-test1.34.1 libboost-regex1.34.1 libboost-wave1.34.1
      libboost-program-options1.34.1 libboost-thread1.34.1
      libboost-serialization1.34.1 libboost-date-time1.34.1 libboost-signals1.34.1
      libboost-graph1.34.1 libboost-iostreams1.34.1 libboost-filesystem1.34.1
      libboost-python1.34.1
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

  14. #14
    Join Date
    Jul 2009
    Location
    Charlotte, NC
    Posts
    42
    If you create a page with just the following then visit it:

    <?php
    phpinfo();
    ?>
    Do you see GD listed on the page as being loaded?

  15. #15
    It's not working...

  16. #16

  17. #17
    Actually, I just solved it. Just save it as *.php instead of *.png...

  18. #18
    Edit: Oops, posted in the wrong 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
  •