473,407 Members | 2,676 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,407 software developers and data experts.

Insert Image as BLOb

Do you know how to insert an image with blob field in asp? I have a code but I have an error, can you help me?
Apr 18 '17 #1
9 5143
ADezii
8,834 Expert 8TB
I've attached a Demo that I created awhile ago that demonstrates how to Edit a specific Graphic Image stored as A BLOB in an OLE Object Field. The original Code is from Alan Warren which I modified to suit a specific User's needs. It also clearly illustrates multiple aspects of BLOB Storage, including: writing a Graphic File as a BLOB to an OLE Object Field, how to read an Image stored as a BLOB, how to Edit a BLOB Image, etc. Most of the relevant Code is contained within the Code Module behind frmInventory.

P.S. - You can also reference this Article that I wrote awhile ago. It generated a lot of interest with multiple Replies from very knowledgeable individuals. You should find it very interesting.
http://bytes.com/topic/access/insigh...blob-not-movie
Attached Files
File Type: zip Blobs_2.zip (887.6 KB, 205 views)
Apr 18 '17 #2
ADezii Will it serve me in sql?
Apr 18 '17 #3
I have this code is asp and it gives me error in the log file
Apr 18 '17 #4
Expand|Select|Wrap|Line Numbers
  1. f Request.TotalBytes > 0 Then
  2. req_bytes = Request.BinaryRead(tot_bytes)
  3.  'Parse POSTed request JSON
  4.  'Parse POSTed request JSON
  5.  reqArgsString = BytesToStr(req_bytes)
  6.  reqArgsArray = Split(reqArgsString, "&")
  7.  For i = 0 To UBound(reqArgsArray)
  8.     reqArgsArray(i) = Split(reqArgsArray(i), "=")
  9.  Next
  10.  
  11.  'Decode base64 image from JSON POST to BytesArray'
  12.  'Decodificar la imagen base64 de JSON POST a Bytes Array'
  13.  base64Encoded = URLDecode(reqArgsArray(1)(1))
  14.  base64Decoded = decodeBase64(base64Encoded)
  15.  'Response.Write base64Decoded
  16.  '' GoTo Done
  17.  
  18.  
  19.   'DB Connection Object
  20.  'Set cn = Server.CreateObject("ADODB.Connection")
  21.  'ConnStr="DRIVER=SQL Server;SERVER=161.196.101.140;UID=sa;PWD=P@ssw0rdsql;Database=ContinuumDB"
  22.  'cn.Open ConnStr
  23.  'Dim strQry 
  24.  'strQry = "INSERT INTO GA_BLOB (""Blob_Segment"", ""Blob_Person_ID"") VALUES (?, ?)"
  25.  
  26.  ' strQry = "INSERT INTO GA_BLOB (""Blob_Person_ID"", ""Blob_Image_ID"", ""Blob_Segment_No"", ""Blob_Format"", ""Blob_Segment"") VALUES (?, ?)"'
  27.  
  28.  '"insert into GA_BLOB (Blob_Person_ID, Blob_Image_ID, Blob_Segment_No, Blob_Format, Blob_Segment) values ('" & Request.form("Blob_Person_ID") & "', '" 0 "','" 0 "','" 0 "', '" & Request.form("Blob_Segment") & "')"'
  29.  
  30.  'Dim cm As ADODB.Command
  31.  'Set cm = New ADODB.Command
  32.  'cm.ActiveConnection = cn
  33.  'cm.CommandText = strQry
  34.  'cm.Parameters.Append cm.CreateParameter("@Blob_Segment", adVarBinary, adParamInput, 100, base64Decoded) 'Leave this parameter first
  35.  'cm.Parameters.Append cm.CreateParameter("@Blob_Person_ID", adInteger, adParamInput, , reqArgsArray(1)(1))
  36.  'cm.CommandType = adCmdText
  37.  'cm.Execute
Apr 18 '17 #5
NeoPa
32,556 Expert Mod 16PB
I've split this hijack question into a new thread in the ASP forum as that's explained as the language used.

@Douglas.
Please be more careful when posting your questions and never add one to an existing thread. Always use the [CODE] tags when including code.

@ADezii.
When you see a hijack of an old thread it's far better to report it than to respond to it. In this case I suspect the question is not only a hijack but also posted in a thread from entirely the wrong forum.

Alternatively feel free to PM me if you see any issue.
Apr 19 '17 #6
ADezii
8,834 Expert 8TB
When you see a hijack of an old thread it's far better to report it than to respond to it. In this case I suspect the question is not only a hijack but also posted in a thread from entirely the wrong forum.
My apologies, missed both points (ASP + Hijack)! Wrongly focused in on the BLOB.
Apr 19 '17 #7
NeoPa
32,556 Expert Mod 16PB
Don't worry about it :-) I doubt Douglas realised what he was doing either. It's not always easy to start in a new environment and get things right first time.

These are just pointers to help.
Apr 19 '17 #8
A thousand apologies just comment seeing the possibility that some of you have the knowledge of what happens to me and could help me really apologize if I offended them I only look for a help to see if they know something of the code in which I am working.
Apr 20 '17 #9
NeoPa
32,556 Expert Mod 16PB
We understand Douglas. We assumed you were innocently asking for help. Sometimes it's difficult to notice some of the other details when you're focused on your own problems.

BTW The thread's been moved to the ASP area now for you. Hopefully you'll get some interest, but often experts will see a thread which already has answers and move on. Also, the Access area is certainly the busiest on the site so I'm not sure how busy this one is nowadays. Even though I'm an administrator of the site as a whole my work is mainly in Access, which I know keeps quite busy.

Best of luck.
Apr 20 '17 #10

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

Similar topics

0
by: Abhishek Bagga | last post by:
I want to insert Image in the column headers of the Listview control I have been trying this but was unable to achieve it. Is it possible? if yes kindly guide me how to achieve this. -- -...
0
by: linus | last post by:
Anyone try insert image or binary files to MySQL using ASP.NET? Thanks a lot
4
by: Piedro | last post by:
Hi group, how do I read a image/blob field in cas option strict is on? First I had it turned off and I read it like this: Dim b() As Byte If Not dsSupp.Tables(0).Rows(0).Item("BITMAP") Is...
2
by: guoqi zheng | last post by:
dear sir, I am using itextShap for pdf generation. I know I can insert image into it, I can add header to it as well. However, I can not add an image as a header. Does any one has experience...
1
by: anuragpj | last post by:
how to insert image in a table in pgsql database.
0
by: gazanfar | last post by:
Yes thanks Question is that ---I want to insert image/or image path in my SQlServer 2000 through Visual basic application.like after scan of any photo i want insert in database on whoever's no...
2
by: shekhar051 | last post by:
how to insert image as a back ground in header row in C#
2
by: lwannwayoo | last post by:
Hi Everybody! I have a database in Microsoft Access 2003 and I want to insert image in my Table Field. How can I don it??. I use OLE type but when i insert image to that field only the word...
3
by: Napsterr | last post by:
I have a RichTextEditor control. I want to insert image whereever the cursor is. Onclicking Insert link i want to insert Image. Is it possible? I have this design in .aspx page. After...
2
by: Roamer | last post by:
Hi, have a problem and do not know hot to solve it. Image needs to insert where the cursor is. I have to hit the space bar, select the space, then insert the image (works). How do I insert...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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
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,...

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.