Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 11th, 2003, 10:14 AM
Registered User
 
Join Date: Jul 2003
Location: Cambridge, On, Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to G-Zilla
Default Imaging

    <?php
    Header("Content-type: image/jpeg");
    $image = imagecreate(200,150);
    $gray = ImageColorAllocate($image,204,204,204);
    $blue = ImageColorAllocate($image,0,0,255);
    ImageLine($image,10,10,150,30,$blue);
    ImageJPEG($image);
    ImageDestroy($image);
    ?>

Gives me nothing but an output of grabled code, that's exactly what's in the book, what is wrong :(

Will appear after each of your posts.

Also I do have the gd_dll uncommented in my php.ini
Reply With Quote
  #2 (permalink)  
Old July 11th, 2003, 10:31 AM
Registered User
 
Join Date: Jul 2003
Location: Cambridge, On, Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to G-Zilla
Default

For those that are having the same problem:

    <?php
    Header("Content-type: image/jpeg");
    $image = ImageCreate(300, 300);
    $gray = ImageColorAllocate($image, 204, 204, 204);
    $blue = ImageColorAllocate($image, 0, 0, 255);
    ImageLine($image, 10, 10, 150, 30, $blue);
    ImageJPEG($image, "image.jpg", 70);
    ImageDestroy($image);

    echo "<img src='image.jpg'>";
    ?>

This is what I had to put to display my image, I don't know if that's what the book was telling you to do and I just don't know how to read, but for anyone who was/is having the same problem I am that works.

Will appear after each of your posts.
Reply With Quote
  #3 (permalink)  
Old July 20th, 2003, 04:41 PM
Authorized User
 
Join Date: Jun 2003
Location: , , USA.
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default

your server might not support jpeg format for php.

----------------------------
http://aeonofdarkness.com
Reply With Quote
  #4 (permalink)  
Old January 30th, 2004, 06:05 AM
Registered User
 
Join Date: Jan 2004
Location: Amersfoort, , Netherlands.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, this helped me. I got the error:
Call to undefined function: imagecreate()
Thanks to your post I found that I had to uncomment the gd.dll in php.ini. This is nowhere stated in the book (as far as I could tell).
In my version of php,it was commented out.

Regards,
Jaap Zwaan
Reply With Quote
  #5 (permalink)  
Old January 30th, 2004, 06:11 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't have the book, but I've seen it and seem to remember it saying you needed to enable the GD extension. Enabling this extension is done differently on various platforms, so telling you explicitly that you need to "uncomment php_gd.dll in php.ini" wouldn't help the linux user base.

While we're on the subject, you should use the php_gd2.dll extension library. The PHP GD extension interface is the same, but it uses the newer GD library under the hood.

  http://www.php.net/image


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk Imaging Scripts82 Pro VB.NET 2002/2003 0 January 4th, 2007 05:32 PM
PHP Multipage Imaging veggivore PHP How-To 0 August 30th, 2006 12:07 AM
??Imaging with encoder with ServletOutputStream? danielh Servlets 0 June 12th, 2005 05:30 PM
Imaging for Windows sgluzberg VB How-To 6 February 14th, 2005 10:35 AM



All times are GMT -4. The time now is 07:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.