473,770 Members | 3,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image displaying problem php

7 New Member
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.  
Apr 2 '09 #1
6 1995
Markus
6,050 Recognized Expert Expert
I'll hazard a guess and say you're not setting the correct content-type?

What happens is you try and go to ViewImage.php?i d=someid (substituting someid for a valid id)?
Apr 2 '09 #2
vikidigi
7 New Member
i have removed the header for the file
[code=php]
<?php
$con = mysql_connect(" localhost","roo t","");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db ("image", $con);
//header('Content-type: image/jpeg');
$query = "SELECT image from images where id=1";
$rs = mysql_fetch_arr ay(mysql_query( $query));
echo base64_decode($ rs["image"]);
[/code=php]
Apr 2 '09 #3
vikidigi
7 New Member
all images are only jpg in database
Apr 2 '09 #4
Markus
6,050 Recognized Expert Expert
Like I said, what happens when you visit the page that displays the image. Note: not the image tag, the actual image serving page.
Apr 2 '09 #5
vikidigi
7 New Member
Displaying image from database

and displays image region in a square with a red Cross {X} in the image area
and not displaying the actual image
Apr 2 '09 #6
vikidigi
7 New Member
the page is error free


contents of the page are

"
Displaying image from database
Image [with Cross]
"
Apr 2 '09 #7

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

Similar topics

2
4185
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or why it doesn't work? Thanks in advance Tjerk
5
1599
by: ken | last post by:
I had to reinstall Windows 2000 Pro and of course Access 2000. I HAD each record displaying a photo but now it does not show them. The WEIRD thing is that when I upload the database to my website...the image shows up! Is there a setting in Access that I need to chnage because of the reinstall? Thanks. Ken
2
3580
by: Al Reid | last post by:
Is it possible to display an image that is stored on the server as a TIFF image, on an ASP.Net page without the use of an add-in viewer? If so, could someone tell me how to do it? TIA -- Al Reid
2
2075
by: pmud | last post by:
Hi, I am designing a simple ASP.NET web page. I have an image button. What I want to do is: when the cursor is over the image button, a drop down meny should display. This menu should have tabs which are images. What can be the C# code for this. Please help. Thanks
7
11639
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
3
5828
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 for multiple page faxes. I have not been able to locate an example to load in the browser or how to handle multiple image in the one column. 1) Ideally it would be nice to display back in the browser since some may be multiple images. I am not...
5
2157
by: ljuljacka | last post by:
I'm trying to display resized images. Locations of images are fetched from database. The problem is that with the following code, I get only the first image displayed: <?php header('Content-type: image/jpeg'); $link = mysql_connect('localhost', 'root', ''); if (!$link) {
6
2195
by: Jeff | last post by:
hi asp.net 2.0 I have a image (.jpeg) stored in sql server 2005 and now I want to display it on a webpage. So I created a webpage (Image.aspx) which just writes the buffer data to the Response object. On Default.aspx I use this Image.aspx for displaying the image, but no image
3
2493
by: brijesh1234 | last post by:
dear Sir/madam I am getting a problem while displaying a image from database Database : MSSQL2000 I have a table named “Image” having following fields as ImageId int Image Image
3
7743
by: mvijayrkumar | last post by:
Hi to all.... Guys pls help me..... I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the images(One coming from DataSet and another from my project image folder) not displaying. Both images are having Type property External and the Values are given correspondingly.ie The One coming from Image Folder;using the Report Parameter ,the...
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
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, 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...
0
10057
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 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...
1
10002
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
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, 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...
0
6676
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();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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 we have to send another system
3
2816
bsmnconsultancy
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...

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.