Re: [PHP] tmpfile() errors?

2002-05-23 Thread Miguel Cruz

On Wed, 22 May 2002, Jas wrote:
>   $tmp_image = tmpfile();
>   $output = fopen($tmp_image, "wb");

tmpfile() opens the file, so you don't need the fopen call.

Just do $output = $tmpfile();

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] tmpfile() errors?

2002-05-22 Thread Jas
 if (!\$this->image =
@imagecreatefrom".$this->image_types[$type]."(\"".$tmp_image."\"))
exit(\"This PHP version cannot create image from
".$this->image_types[$type]."\");
");
unlink($tmp_image);
$this->image_height = $height;
$this->image_width  = $width;
break;
default:
exit("ASCIIArtist(): Cannot determine image type of
".$image.".");
}
} // end constructor
}
?>
I am not quite sure how I can resolve this as is... It is not that important
to get working but I think it would be neat to see and test out a bit.  If
there is a way to do the same thing without using a temp file that might
work in my case.
Jas

"1lt John W. Holmes" <[EMAIL PROTECTED]> wrote in message
012d01c201d3$17a91780$2f7e3393@TB447CCO3">news:012d01c201d3$17a91780$2f7e3393@TB447CCO3...
> You're not even trying to open a file. You're trying to open a Resource,
> which makes me think that fopen() is being called twice or something. You
> obviously have something very wrong.
>
> Can you show the code around these lines where you're trying to open the
> file? All of the errors are because of the first one.
>
> ---John Holmes...
>
> > -Original Message-
> > From: Jas [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 22, 2002 4:18 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] tmpfile() errors?
> >
> >
> > Here are the errors I am recieving:
> > Warning: fopen("Resource id #4","wb") - Permission denied in
> > /path/to/asciiartist.php on line 295
> >
> > Warning: Supplied argument is not a valid File-Handle resource in
> > /path/to/asciiartist.php on line 296
> >
> > Warning: Supplied argument is not a valid File-Handle resource in
> > /path/to/asciiartist.php on line 297
> >
> > Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
> > /path/to/asciiartist.php on line 303
> > ASCIIArtist(): Cannot determine image type of shared/image02.jpg.
> >
> > I have checked the file permissions for the files and directory in
> question
> > and they are all set to read & write, so I know this is not the problem.
> > Here is the function that I am trying to get to work.
> >
> > function ASCIIArtist($image)
> > {
> > if ($input = @fopen($image, "rb")) {
> >   $image_data = fread ($input, 2048576);
> >   fclose($input);
> >   $tmp_image = tmpfile();
> >   $output = fopen($tmp_image, "wb");
> >   fwrite($output, $image_data);
> >   fclose($output);
> > } else {
> > exit("Cannot access ".$image." for reading. (Does not exist
or
> > has wrong permissions)");
> > }
> >
> > This code is from http://www.sebastian-r.de/.  And everything works fine
> > until it hits this function. Could I get some enlightenment on why it
> cannot
> > create a temp file named $tmp_image?  (ecspecially when the permissions
> for
> > the file are correct?)  Thanks in advance,
> > Jas
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] tmpfile() errors?

2002-05-22 Thread 1LT John W. Holmes

You're not even trying to open a file. You're trying to open a Resource,
which makes me think that fopen() is being called twice or something. You
obviously have something very wrong.

Can you show the code around these lines where you're trying to open the
file? All of the errors are because of the first one.

---John Holmes...

> -Original Message-
> From: Jas [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 22, 2002 4:18 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] tmpfile() errors?
>
>
> Here are the errors I am recieving:
> Warning: fopen("Resource id #4","wb") - Permission denied in
> /path/to/asciiartist.php on line 295
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /path/to/asciiartist.php on line 296
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /path/to/asciiartist.php on line 297
>
> Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
> /path/to/asciiartist.php on line 303
> ASCIIArtist(): Cannot determine image type of shared/image02.jpg.
>
> I have checked the file permissions for the files and directory in
question
> and they are all set to read & write, so I know this is not the problem.
> Here is the function that I am trying to get to work.
>
> function ASCIIArtist($image)
> {
> if ($input = @fopen($image, "rb")) {
>   $image_data = fread ($input, 2048576);
>   fclose($input);
>   $tmp_image = tmpfile();
>   $output = fopen($tmp_image, "wb");
>   fwrite($output, $image_data);
>   fclose($output);
> } else {
> exit("Cannot access ".$image." for reading. (Does not exist or
> has wrong permissions)");
> }
>
> This code is from http://www.sebastian-r.de/.  And everything works fine
> until it hits this function. Could I get some enlightenment on why it
cannot
> create a temp file named $tmp_image?  (ecspecially when the permissions
for
> the file are correct?)  Thanks in advance,
> Jas
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] tmpfile() errors?

2002-05-22 Thread James E. Hicks III

I'd check the owner of the directory you are trying to write to. It needs to be
owned by the same user as the httpd process runs as.

James

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 4:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] tmpfile() errors?


Here are the errors I am recieving:
Warning: fopen("Resource id #4","wb") - Permission denied in
/path/to/asciiartist.php on line 295

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 296

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 297

Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
/path/to/asciiartist.php on line 303
ASCIIArtist(): Cannot determine image type of shared/image02.jpg.

I have checked the file permissions for the files and directory in question
and they are all set to read & write, so I know this is not the problem.
Here is the function that I am trying to get to work.

function ASCIIArtist($image)
{
if ($input = @fopen($image, "rb")) {
  $image_data = fread ($input, 2048576);
  fclose($input);
  $tmp_image = tmpfile();
  $output = fopen($tmp_image, "wb");
  fwrite($output, $image_data);
  fclose($output);
} else {
exit("Cannot access ".$image." for reading. (Does not exist or
has wrong permissions)");
}

This code is from http://www.sebastian-r.de/.  And everything works fine
until it hits this function. Could I get some enlightenment on why it cannot
create a temp file named $tmp_image?  (ecspecially when the permissions for
the file are correct?)  Thanks in advance,
Jas



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] tmpfile() errors?

2002-05-22 Thread Jas

Here are the errors I am recieving:
Warning: fopen("Resource id #4","wb") - Permission denied in
/path/to/asciiartist.php on line 295

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 296

Warning: Supplied argument is not a valid File-Handle resource in
/path/to/asciiartist.php on line 297

Warning: getimagesize: Unable to open 'Resource id #4' for reading. in
/path/to/asciiartist.php on line 303
ASCIIArtist(): Cannot determine image type of shared/image02.jpg.

I have checked the file permissions for the files and directory in question
and they are all set to read & write, so I know this is not the problem.
Here is the function that I am trying to get to work.

function ASCIIArtist($image)
{
if ($input = @fopen($image, "rb")) {
  $image_data = fread ($input, 2048576);
  fclose($input);
  $tmp_image = tmpfile();
  $output = fopen($tmp_image, "wb");
  fwrite($output, $image_data);
  fclose($output);
} else {
exit("Cannot access ".$image." for reading. (Does not exist or
has wrong permissions)");
}

This code is from http://www.sebastian-r.de/.  And everything works fine
until it hits this function. Could I get some enlightenment on why it cannot
create a temp file named $tmp_image?  (ecspecially when the permissions for
the file are correct?)  Thanks in advance,
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php