Re: PHP & GD open image file error
| From: | Kyle Jerviss | Date: | Fri, 22 Dec 2000 20:01:03 +0000 |
| Subject: | Re: PHP & GD open image file error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31626@lists.php.net to get a copy of this message | ||
First off, if you are using the Content-type: header, you can't feed out
any HTML. If you use ImageGIF($im); and don't put any HTML after the >?
tag it'll probably work.
If you want to have the script make the image, then have the browser
load it with a IMG tag, leave out that Contenent-type: header.
I don't understand directory permissions as well as I probably should,
but I've got a directory that I stuff some dynamic thumbnails in, and it
is owned by nobody/nobody and is mode 777.
Ken Whitmore wrote:
>
> I'm just starting out with GD in PHP and have a problem.
> I've created a file named drawimage.php with the contents listed at the end
> of this message.
> When I attempt to browse the page in MSIE, (haven't tried it on any other
> yet,) an error message appears in the browser window and a missing image
> icon shows below the message.
>
> The error message is as follows:
> Warning: imagegif: unable to open 'out.gif' for writing in
> /home/httpd/html/wow/pedigree/php/drawimage.php on line 8
>
> I've checked the server with phpinfo(); and it shows that GD is enabled and
> GIF support is also.
> The directory "dynamic_images" is set for drwxrw-rw- (to avoid somebody
> putting something executable in there and executing it). Assuming php is
> using "nobody" because it's being called by Apache, which is set for
> "nobody", what could be the problem here? (I'm assuming, because I haven't
> checked inside PHP for the user yet, but my Apache definitely uses
> "nobody".)
>
> ============================================================================
> =====
> PHP File Listing
> ============================================================================
> =====
> <?php
> // File: drawimage.php
> Header("Content-type: image/gif"); // tell user agent to receive a gif image
> $im = ImageCreate(100,100); // Create the image buffer
> $black = ImageColorAllocate($im,0,0,0); // Create black color
> $white = ImageColorAllocate($im,255,255,255); // Create white color
> ImageLine($im,0,0,99,99); // Draw a diagonal line
> ImageGIF($im,"dynamic_images/out.gif"); // Create and write GIF file. (THIS
> LINE GETS THE ERROR!)
> ImageDestroy($im); // Destroy image buffer
> ?>
>
> <HTML>
> <HEAD>
> <TITLE>Test GD</TITLE>
> </HEAD>
> <BODY>
> <IMG SRC="dynamic_images/out.gif">
> </BODY>
> </HTML>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net