Ask a Question related to PHP Development, Design and Development.
-
kristofl #1
determine image information on image stored in MySQL BLOB
Hi all,
I store images in my DB as BLOB. When I want to place them in an html
table, I want to determine the width of the image in order to asign the
correct width to the column inside table.
For JPEGs this is working fine, this is my code:
$image = @imagecreatefromstring($r["foto"]);
return @imagesx($image);
where $r["foto"] is the field selected from the db which contains the image.
For GIFs however, its getting really on my nerves !!
I know imagecreatefromstring is not supported in gd2 and I tried several
thinks. None of them worked ! :
-
$temp = tmpfile();
list($width, $height, $type, $attr) = getimagesize($temp);
echo $attr;
gives me :Warning: getimagesize: Unable to open 'Resource id #6' for reading
-
$handle = fopen("/tmp/tmp.dat", "w+");
fwrite($handle, $r["foto"]);
list($width, $height, $type, $attr) = getimagesize($handle);
echo $attr;
gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
reading
-
Doing this with imagecreatefromgif($temp); wont work either !
Can somebody help me out please? by telling me what I'm doing wrong or what
I should do.
Regards,
Kristof
kristofl Guest
-
how to view a BLOB (image)
<cfquery datasource='dbsource' username='username' password='password' name='viewpic'> select image from images where id = 1 </cfquery> <cfset... -
Image Scale Information
Hello all. Can anyone tell me if there is a way to determine the scale of an image I have changed on page in InDesign? (PC and Mac) I've... -
BLOB Image from Interbase in ASP
Response.BinaryWrite the value from the recordset? Ray at work "Daniel Olivares" <danielog76@hotmail.com> wrote in message... -
BLOB Image fron Interbase in ASP....
Please don't multipost. Answered elsewhere. Ray at work "Daniel Olivares" <danielog76@hotmail.com> wrote in message... -
how to show image retrieved from BLOB on the web page
Hi, Does anyone know how to retrieve binary image data from BLOB column of SQL database table and show it on the web page. I know "img src=" tag... -
Randell D. #2
Re: determine image information on image stored in MySQL BLOB
"kristofl" <kristof.loots@skynet.be> wrote in message
news:3f7b33b8$0$31719$ba620e4c@reader1.news.skynet .be...image.> Hi all,
>
> I store images in my DB as BLOB. When I want to place them in an html
> table, I want to determine the width of the image in order to asign the
> correct width to the column inside table.
> For JPEGs this is working fine, this is my code:
>
> $image = @imagecreatefromstring($r["foto"]);
> return @imagesx($image);
>
> where $r["foto"] is the field selected from the db which contains thereading>
> For GIFs however, its getting really on my nerves !!
> I know imagecreatefromstring is not supported in gd2 and I tried several
> thinks. None of them worked ! :
> -
> $temp = tmpfile();
> list($width, $height, $type, $attr) = getimagesize($temp);
> echo $attr;
>
> gives me :Warning: getimagesize: Unable to open 'Resource id #6' forTwo things I'd try...> -
> $handle = fopen("/tmp/tmp.dat", "w+");
> fwrite($handle, $r["foto"]);
> list($width, $height, $type, $attr) = getimagesize($handle);
> echo $attr;
>
> gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
> reading
<?
$temp = tmpfile();
$tmpArray = getimagesize($temp);
foreach($tmpArray as $key=>$value)
{ print("<br>$key = $value"); }
?>
Compare the output for jpegs, gifs, png images for the hell of it and see if
there is a difference in the output above.
And... just for the hell of it - if the above doesn't work, try and close
after you created the tmp file... thus
<?
$handle = fopen("/tmp/tmp.dat", "w+");
fwrite($handle, $r["foto"]);
fclose($handle); // You don't need fopen for getimagesize to work
list($width, $height, $type, $attr) = getimagesize($handle);
echo $attr;
?>
Drop another byte and let us know if either of the above work/fail for
you...
Randell D. Guest
-
kristofl #3
Re: determine image information on image stored in MySQL BLOB
"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
news:B_Meb.3498$9l5.1207@pd7tw2no...if>
> "kristofl" <kristof.loots@skynet.be> wrote in message
> news:3f7b33b8$0$31719$ba620e4c@reader1.news.skynet .be...> image.> > Hi all,
> >
> > I store images in my DB as BLOB. When I want to place them in an html
> > table, I want to determine the width of the image in order to asign the
> > correct width to the column inside table.
> > For JPEGs this is working fine, this is my code:
> >
> > $image = @imagecreatefromstring($r["foto"]);
> > return @imagesx($image);
> >
> > where $r["foto"] is the field selected from the db which contains the> reading> >
> > For GIFs however, its getting really on my nerves !!
> > I know imagecreatefromstring is not supported in gd2 and I tried several
> > thinks. None of them worked ! :
> > -
> > $temp = tmpfile();
> > list($width, $height, $type, $attr) = getimagesize($temp);
> > echo $attr;
> >
> > gives me :Warning: getimagesize: Unable to open 'Resource id #6' for>> > -
> > $handle = fopen("/tmp/tmp.dat", "w+");
> > fwrite($handle, $r["foto"]);
> > list($width, $height, $type, $attr) = getimagesize($handle);
> > echo $attr;
> >
> > gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
> > reading
> Two things I'd try...
>
> <?
> $temp = tmpfile();
> $tmpArray = getimagesize($temp);
> foreach($tmpArray as $key=>$value)
> { print("<br>$key = $value"); }
> ?>
>
> Compare the output for jpegs, gifs, png images for the hell of it and seeNone of the above worked, I'm still trying. Any ideas?> there is a difference in the output above.
>
>
> And... just for the hell of it - if the above doesn't work, try and close
> after you created the tmp file... thus
>
> <?
> $handle = fopen("/tmp/tmp.dat", "w+");
> fwrite($handle, $r["foto"]);
> fclose($handle); // You don't need fopen for getimagesize to work
>
> list($width, $height, $type, $attr) = getimagesize($handle);
> echo $attr;
> ?>
>
>
> Drop another byte and let us know if either of the above work/fail for
> you...
>
>
kristofl Guest



Reply With Quote

