Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- From: lkrubner@xxxxxxxxxxxxx
- Date: 4 Nov 2005 11:35:03 -0800
Andy Hassall wrote:
> On 4 Nov 2005 10:05:06 -0800, lkrubner@xxxxxxxxxxxxx wrote:
> >>
> >> You probably want a sequence of:
> >>
> >> http://uk.php.net/file_get_contents - get the image from a file or URL
> >>
> >> http://uk.php.net/imagecreatefromstring - create a GD image object
> >
> >Well, I'm groping in the dark here, but I think that
> >imagecreatefromstring would give me an actual image, whereas what I
> >want is an actual string, and I don't know how to get a string from an
> >image file.
>
> That was why I posted the rest of my post, you've stopped reading too early.
Apologies, I should have looked up those functions to see exactly what
you were suggesting.
I'll try something like this:
$myFileAsString = file_get_contents("myFile.jpg");
$image = imagecreatefromstring($myFileAsString);
$width = imagesx($image);
$height = imagesy($image);
for ($i=0; $i < $width; $i++) {
for ($r=0; $r < height; $r++) {
$rgb = imagecolorat($image, $width, $height)
echo $rgb;
}
}
.
- References:
- do I use fopen or fsockopen to get an image as a stream of bytes?
- From: lkrubner
- Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- From: Andy Hassall
- Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- From: lkrubner
- Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- From: Andy Hassall
- do I use fopen or fsockopen to get an image as a stream of bytes?
- Prev by Date: Re: from PHP -> db2_connect() Undefined Function
- Next by Date: Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- Previous by thread: Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- Next by thread: Re: do I use fopen or fsockopen to get an image as a stream of bytes?
- Index(es):
Relevant Pages
|