473,485 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP retrieve image from Mysql database

I was able to insert images into mysql stored as binary data. How do I
retrieve it. Please provide thorough explanation. Thanks.

Jun 7 '06 #1
2 16763
"webmechanic" <dm*******@yahoo.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I was able to insert images into mysql stored as binary data. How do I
retrieve it. Please provide thorough explanation. Thanks.


Do your SELECT:

$query = "SELECT blobfield FROM table WHERE ????";

$result = mysql_query($query, $dbc);
$result_data = mysql_fetch_array($result, MYSQL_ASSOC);
$img = imagecreatefromstring($result_data['blobfield']);

---

Just lookup the exact function parameters as that is just off the top off my
head...

Norm
--
FREE Avatar hosting at www.easyavatar.com
Jun 7 '06 #2
"webmechanic" wrote :
I was able to insert images into mysql stored as binary data.


because its a binary data you can just echo the content data. Try like
this :

<?php
$query = "SELECT blobfield FROM table WHERE ????";
$result = mysql_query($query, $dbc);
$result_data = mysql_fetch_array($result, MYSQL_ASSOC);
header("Content-type: image/jpeg") ;
echo $result_data['blobfield'];

?>

regards,

Lorento
--
http://blogs.deshot.com
http://www.mastervb.net
http://www.immersivelounge.com

Jun 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5266
by: Bob Kaku | last post by:
I'm trying to retrieve a text value from a MySQL database, put it into an updateable form, allow edits, and send back the edited text back into the MySQL database. I've been able to successfully...
7
3571
by: theonlydrayk | last post by:
the script that show image is : <?php include('dbinfo.inc.php'); mysql_connect($localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query =...
16
2976
by: Daniel Tonks | last post by:
First, please excuse the fact that I'm a complete MySQL newbie. My site used forum software that I wrote myself (in Perl) which, up until now, has used flat files. This worked fine, however...
10
7376
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...
5
2912
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
2
5408
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
1
13200
by: ahujasatna | last post by:
Hi all!! i am working on C#, ASP.Net with Sql server2000 and i am facing a problem, my Question is: "How to insert and retrieve images to/from Sqlserver2000 Database" I created a table...
2
4166
by: jsd219 | last post by:
Hello, i am having problems displaying an image once i have uploaded it. i upload it to a folder and store its name in a database. below is the code to display the image. I have figured out the the...
3
1877
by: alexseow | last post by:
<img src="image.asp?id=1"> --------------------------------------------------------------- <%Option Explicit%> <!-- #include file="IMS/includes/dbconn.asp"--> <% dim MyConn,SQL Set MyConn...
0
7090
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7116
Oralloy
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,...
0
7161
jinu1996
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...
1
6825
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7275
tracyyun
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...
0
5418
agi2029
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,...
0
3058
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...
0
1376
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.