 |
| 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
|
|
|
|

July 11th, 2003, 09:14 AM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 11th, 2003, 09:31 AM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

July 20th, 2003, 03:41 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
your server might not support jpeg format for php.
----------------------------
http://aeonofdarkness.com
|
|

January 30th, 2004, 06:05 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 30th, 2004, 06:11 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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/
|
|
 |