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 = @imagecreatefro mstring($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 imagecreatefrom string is not supported in gd2 and I tried several
thinks. None of them worked ! :
-
$temp = tmpfile();
list($width, $height, $type, $attr) = getimagesize($t emp);
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($h andle);
echo $attr;
gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
reading
-
Doing this with imagecreatefrom gif($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 2 7193
"kristofl" <kr***********@ skynet.be> wrote in message
news:3f******** *************** @reader1.news.s kynet.be... 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 = @imagecreatefro mstring($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 imagecreatefrom string is not supported in gd2 and I tried several thinks. None of them worked ! : - $temp = tmpfile(); list($width, $height, $type, $attr) = getimagesize($t emp); 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($h andle); echo $attr;
gives me : Warning: getimagesize: Unable to open 'Resource id #6' for reading
Two things I'd try...
<?
$temp = tmpfile();
$tmpArray = getimagesize($t emp);
foreach($tmpArr ay 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($h andle);
echo $attr;
?>
Drop another byte and let us know if either of the above work/fail for
you...
"Randell D." <yo************ **************@ yahoo.com> wrote in message
news:B_Meb.3498 $9l5.1207@pd7tw 2no... "kristofl" <kr***********@ skynet.be> wrote in message news:3f******** *************** @reader1.news.s kynet.be... 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 = @imagecreatefro mstring($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 imagecreatefrom string is not supported in gd2 and I tried several thinks. None of them worked ! : - $temp = tmpfile(); list($width, $height, $type, $attr) = getimagesize($t emp); 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($h andle); echo $attr;
gives me : Warning: getimagesize: Unable to open 'Resource id #6' for reading
Two things I'd try...
<? $temp = tmpfile(); $tmpArray = getimagesize($t emp); foreach($tmpArr ay 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($h andle); echo $attr; ?>
Drop another byte and let us know if either of the above work/fail for you...
None of the above worked, I'm still trying. Any ideas? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob |
last post by:
Ummm...I'm a little stuck on how to approach the following....
I have a mySQL table holding images (fields are: data (blob), name (text),
type (text), size(text), desc (text) )
If I want to show the image on a page (they're all jpg's), how do I do I
implement this?
Uploading, downloading, text listing it is easy...I'm just wondering how I
SHOW it. :-)
|
by: Alper Adatoz |
last post by:
Hi,
i have a little problem. i hope u guys give me a clear solution (:
db: mssql
i just want to put jpeg file to the image field at the mssql db.
and after that i want to call it back..
|
by: Kevin |
last post by:
Hi all,
Assuming I have stored the binary data of an image file in a blob field
of a table, how can I display it as an image in a web page? I found some
instructions on the web, such as
header('application/octet-stream');
echo $imgdata;
I don't know why I always get this warning.
|
by: bissatch |
last post by:
Hi,
I am trying to write script that is run when a form is submitted. The
form contains an image input field and when submitted, the image is
uploaded, resized and added as binary information to a db table. Please
note, I am using a PostgreSQL database
I have written all the code out below that deals with the submission
processing:
|
by: John Smith |
last post by:
I know that uploading an image to a database has been covered, oh, about 3
trillion times. However, I haven't found anything covering uploading to a
MySQL database with .net. Please don't recommend storing the image to the
filesystem and only keeping a pointer to that in the table. I want to dump
the image to a table. My code dumps the data into the table, however, I get
the following error when trying to view the image "the image ......
| |
by: Chucker |
last post by:
Hi Community,
I think I can store Binary Data in SQL Server but when I try to retrieve it,
I always only get one byte.
I think I stored my Binary Data in SQL Server in a Colum of Type Image. At
least when I execute the following code, I get some significant network
traffic. When I check the database with query analyzer, I see 4 Hex Chars in
the image colum. Like 0xe0 etc.
|
by: yoyo |
last post by:
Ok, I think I just may be a moron, but where the heck are the Image
extenders found? I've look all around, tried all the DB2 cd's I have,
are they installed by default somewhere? Which install fileset (AIX) are
they part of?
The CD's only show spatial and xml extenders?
|
by: eholz1 |
last post by:
Hello Group,
Perhaps you can help me. I have a mysql db, that holds images.
Images are encoded using base64_decode/encode, etc. Image data seems
fine.
I have a view.php page that is supposed to show the image, and an
image.php page that accesses
the database, retrives the image data, and then (theoretically) prints
the decoded data to the page.
below is the view.php page code: problem area the img tag src no
|
by: dimitri pater |
last post by:
Hi,
I am trying to insert an image, which is stored as a blob in MySQL,
into a table using Reportlab.
I have tried this:
from StringIO import StringIO
cfoto = StringIO(result) # where result is the 'blob'
cfoto.seek(0)
foto=cfoto.getvalue
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |