Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 11th, 2003, 09:14 AM
Registered User
 
Join Date: Jul 2003
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
 
Old July 11th, 2003, 09:31 AM
Registered User
 
Join Date: Jul 2003
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.
 
Old July 20th, 2003, 03:41 PM
Authorized User
 
Join Date: Jun 2003
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
 
Old January 30th, 2004, 06:05 AM
Registered User
 
Join Date: Jan 2004
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
 
Old January 30th, 2004, 06:11 PM
Friend of Wrox
 
Join Date: Jun 2003
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/





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 29th, 2006 11:07 PM
??Imaging with encoder with ServletOutputStream? danielh Servlets 0 June 12th, 2005 04:30 PM
Imaging for Windows sgluzberg VB How-To 6 February 14th, 2005 10:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.