473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Image from Blob

PLz Help
i have some Images in DataBase in Blob field
but images are displayed with a Cross (X) not the actual image

MainPage.php//code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = mysql_connect("localhost","root","");
  3. if (!$con)
  4.    die('Could not connect: ' . mysql_error());
  5. mysql_select_db("db1", $con);
  6. $image = mysql_query("SELECT * FROM userimagetable");
  7. while($imageResult = mysql_fetch_array($image) ){
  8.     ?>
  9.     <img src="ViewImage.php?id=<?=$imageResult['id']?>" alt="Picture" /></td></tr>
  10.     <?php 
  11. }
  12.  
  13. and the other file displaying image code is
  14.  
  15. ViewImage.php
  16. <?php
  17. $id = $_GET['id'];
  18. $image = mysql_query("SELECT * FROM userimagetable WHERE Id='".$id."'");
  19. $imageResult = mysql_fetch_array($image);
  20.     header("Content-type: image/jpg");
  21. echo $imageResult['UserImage'];
  22. ?>
  23.  
plz help me
Mar 22 '09 #1
2 1741
tlhintoq
3,525 Expert 2GB
Vikidigi:
In the future please do not hijack someone else's thread for your question. This is not the best way to get an answer to your question because most people think that the original question has been answered.

Please visit the Posting Guidelines for tips on how to ask questions to get the best help. I have moved your post to the start of a new thread.

TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Mar 22 '09 #2
pbmods
5,821 Expert 4TB
Heya, vikidigi.

Try viewing ViewImage.php directly in your browser and seeing if it is outputting the image correctly. If not, try removing the content-type line to see if your script is outputting an error message that is interfering with the image output.
Mar 23 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
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...
2
by: Eric McDaniel | last post by:
I am trying to read in a bunch of images and manipulate them using Image::Magick, then display them using Tk::Photo. I would like to do this without creating a temp file for each image, since there...
2
by: Bob | last post by:
Hello: I've tried showing an image field from an MS SQL Server 2000 image field on an ASP page but All I get is this http://http://new.confectioneryhouse.com/glutenfree/about.asp I added the...
1
by: Roberto Castro | last post by:
I have some problems with the way I am showing the BLOB fields in the Image web controls. It does work on my localhost though sometimes I need to hit Refresh for the images to load properly....
2
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....
35
by: Stan Sainte-Rose | last post by:
Hi, What is the better way to save image into a database ? Just save the path into a field or save the image itself ? I have 20 000 images (~ 10/12 Ko per image ) to save. Stan
3
by: meyvn77 | last post by:
Hello - I am looking for the best way to store images in a Access DB. My Idea - I have a table with 150,000 records. These recoreds represent a Crash (Traffic Accident). I have 50 different...
8
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...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.