Hello All:
I have a field in the database that is an Image. I have no idea how the
data is stored in here (Image, compressed, encrypted, plain text, etc). I am
trying to write the contents to a text file, image file, etc so I can see if
the data is stored in a way we can understand (we have been tasked to write
an app and the app needs to read this field, but we don't know what it really
contains).
How would I go about reading the data from this field and saving the
contents to a text field, as well as an image? I know conceptually how to do
it, but having issues with the syntax and actual code that is needed.
Thanks
Andy 4 7607
Andy,
If the image is compressed or encrypted, I don't know that looking at
the byte stream is going to do you much good.
Why not just save the contents to a file, and change the extension on
the file, see if anything works opening it?
Also, how is it that you can't know the storage format? Do you have
another system that accesses this DB? If so, do you have the code for that
system?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message
news:5E******** *************** ***********@mic rosoft.com... Hello All:
I have a field in the database that is an Image. I have no idea how the data is stored in here (Image, compressed, encrypted, plain text, etc). I am trying to write the contents to a text file, image file, etc so I can see if the data is stored in a way we can understand (we have been tasked to write an app and the app needs to read this field, but we don't know what it really contains).
How would I go about reading the data from this field and saving the contents to a text field, as well as an image? I know conceptually how to do it, but having issues with the syntax and actual code that is needed.
Thanks Andy
Nicholas:
Thank you for the response.
We are not sure if the image is compressed or encrypted. All that we know
at this time is the data is stored as an Image in the database. We have a
program that uses this data and displays the information. However: this is
a third party windows tool that we want to re-write portions (for reporting
purposes) for the web. So we are not sure how this software uses that image
data. As a result: we are not sure if the data is stored encrypted,
compressed, hashed or as plain text.
I am not really sure how to save this information to a text file, that is
the issue I am having at the moment. I can't find examples on how to do this
with values from a database.
Thanks
Andy
"Nicholas Paldino [.NET/C# MVP]" wrote: Andy,
If the image is compressed or encrypted, I don't know that looking at the byte stream is going to do you much good.
Why not just save the contents to a file, and change the extension on the file, see if anything works opening it?
Also, how is it that you can't know the storage format? Do you have another system that accesses this DB? If so, do you have the code for that system?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message news:5E******** *************** ***********@mic rosoft.com... Hello All:
I have a field in the database that is an Image. I have no idea how the data is stored in here (Image, compressed, encrypted, plain text, etc). I am trying to write the contents to a text file, image file, etc so I can see if the data is stored in a way we can understand (we have been tasked to write an app and the app needs to read this field, but we don't know what it really contains).
How would I go about reading the data from this field and saving the contents to a text field, as well as an image? I know conceptually how to do it, but having issues with the syntax and actual code that is needed.
Thanks Andy
Andy,
If it is a byte array (which it would appear that it is), then just open
up a FileStream and then write the file out somewhere. You can change the
extension in explorer and see if any of the programs registered for those
extensions will open it up (like zip programs, image viewers, etc, etc).
If it is encrypted, then you are going to have a problem, since you
probably don't have access to the keys required for decryption.
Given the myriad number of possibilities, it is probably within your
best interests to contact the vendor and ask what the format is, try and get
it from them.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message
news:08******** *************** ***********@mic rosoft.com... Nicholas:
Thank you for the response.
We are not sure if the image is compressed or encrypted. All that we know at this time is the data is stored as an Image in the database. We have a program that uses this data and displays the information. However: this is a third party windows tool that we want to re-write portions (for reporting purposes) for the web. So we are not sure how this software uses that image data. As a result: we are not sure if the data is stored encrypted, compressed, hashed or as plain text.
I am not really sure how to save this information to a text file, that is the issue I am having at the moment. I can't find examples on how to do this with values from a database.
Thanks Andy
"Nicholas Paldino [.NET/C# MVP]" wrote:
Andy,
If the image is compressed or encrypted, I don't know that looking at the byte stream is going to do you much good.
Why not just save the contents to a file, and change the extension on the file, see if anything works opening it?
Also, how is it that you can't know the storage format? Do you have another system that accesses this DB? If so, do you have the code for that system?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message news:5E******** *************** ***********@mic rosoft.com... > Hello All: > > I have a field in the database that is an Image. I have no idea how > the > data is stored in here (Image, compressed, encrypted, plain text, etc). > I > am > trying to write the contents to a text file, image file, etc so I can > see > if > the data is stored in a way we can understand (we have been tasked to > write > an app and the app needs to read this field, but we don't know what it > really > contains). > > How would I go about reading the data from this field and saving the > contents to a text field, as well as an image? I know conceptually how > to > do > it, but having issues with the syntax and actual code that is needed. > > Thanks > Andy
Nicholas:
Perhaps you might be so kind to show me what I am doing wrong (dr["scan"] is
the Image value from the database).
FileStream fs = new FileStream("C:\ \test.txt", FileMode.Create );
BinaryWriter br = new BinaryWriter(fs );
br.Write(fs.Rea d(dr["scan"]));
br.Flush();
br.Close();
fs.Flush();
fs.Close();
Thanks
Andy
"Nicholas Paldino [.NET/C# MVP]" wrote: Andy,
If it is a byte array (which it would appear that it is), then just open up a FileStream and then write the file out somewhere. You can change the extension in explorer and see if any of the programs registered for those extensions will open it up (like zip programs, image viewers, etc, etc).
If it is encrypted, then you are going to have a problem, since you probably don't have access to the keys required for decryption.
Given the myriad number of possibilities, it is probably within your best interests to contact the vendor and ask what the format is, try and get it from them.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message news:08******** *************** ***********@mic rosoft.com... Nicholas:
Thank you for the response.
We are not sure if the image is compressed or encrypted. All that we know at this time is the data is stored as an Image in the database. We have a program that uses this data and displays the information. However: this is a third party windows tool that we want to re-write portions (for reporting purposes) for the web. So we are not sure how this software uses that image data. As a result: we are not sure if the data is stored encrypted, compressed, hashed or as plain text.
I am not really sure how to save this information to a text file, that is the issue I am having at the moment. I can't find examples on how to do this with values from a database.
Thanks Andy
"Nicholas Paldino [.NET/C# MVP]" wrote:
Andy,
If the image is compressed or encrypted, I don't know that looking at the byte stream is going to do you much good.
Why not just save the contents to a file, and change the extension on the file, see if anything works opening it?
Also, how is it that you can't know the storage format? Do you have another system that accesses this DB? If so, do you have the code for that system?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Andy" <An**@discussio ns.microsoft.co m> wrote in message news:5E******** *************** ***********@mic rosoft.com... > Hello All: > > I have a field in the database that is an Image. I have no idea how > the > data is stored in here (Image, compressed, encrypted, plain text, etc). > I > am > trying to write the contents to a text file, image file, etc so I can > see > if > the data is stored in a way we can understand (we have been tasked to > write > an app and the app needs to read this field, but we don't know what it > really > contains). > > How would I go about reading the data from this field and saving the > contents to a text field, as well as an image? I know conceptually how > to > do > it, but having issues with the syntax and actual code that is needed. > > Thanks > Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dave |
last post by:
Hello there,
I am at my wit's end ! I have used the following script succesfully to
upload an image to my web space. But what I really want to be able to do is
to update an existing record in a table in MySQL with the path & filename to
the image.
I have successfully uploaded and performed an update query on the database,
but the problem...
|
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...
|
by: Anonieko Ramos |
last post by:
> I have a graphics images that I want to convert to
> ASCII art. How do I do it?
>
Code:
- Default.aspx.cs
|
by: dale zhang |
last post by:
Hi,
I am trying to read an image from MS Access DB based on the following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
The article author is using PictureBox for windows application, while I am
doing for web. I can only find Image from web forms control and HTML control.
This may be the root cause of my problem. For...
|
by: dale zhang |
last post by:
Hi,
I am trying to save and read an image from MS Access DB based on the
following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
Right now, I saved images without any errors. After reading the ole object
from db, I saved it to C: as file1.bmp and displayed on the web. But it can
not be displayed. After I manually sent...
| |
by: John Thompson |
last post by:
We're sooo close. When we load the page to upload the image, all of
the prms go through except the binary image data. Using SQL server
with the data type set to "image".
Please help!
Thanks-
John
|
by: Kim |
last post by:
Random image downloader for specified newsgroup. Hi I'm writing a small script that will download random images from a specified newsgroup. I've imported yenc into the script but I can't open the image or save it. This is my first script so be gentle!
Heres the script
####random group downloader####
import nntplib
import string, random...
|
by: Peter |
last post by:
I have a problem with a page show_image.asp that returns a jpg image under
Windows XP Pro SP2. The page sets content type as:
Response.ContentType = "image/jpg"
While this works perfectly fine on most machines, on some machines I
experience this problem:
When loading the page a window pops up that asks if I want to open the
document...
|
by: premprakashbhati |
last post by:
hi, good evening..
i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button()
here is the code ...its work fine when iam using a normal web page... but can't in content page....
Code in Master Page
<%@ Master Language="C#" AutoEventWireup="true"...
|
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...
|
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...
| |
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. ...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |