473,569 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.net Ques: Image Retrieval

Hi, I am pretty new to ASP.net

I want to do the following but I have been unable to find good info/ or
sample code on it; please help;

- retrieve a gif/jpeg image using ASP.net from another site

- using ASP.net (Visual Basic.net or C#) code I want to edit the image by
superimposing a smaller image on the lower right hand corner

- then display the image to the user

- if possible, store the image to MySQL server

Thank you in advance. and please be as detail as you like.

Joe.

Nov 17 '05 #1
2 1304
Hi,

Maybe you can use this sample that I once made how you can do it. This uses
images in a database, you can as well choise for using paths. Where in my
opinion this one is better for securing your images.

However, when you store your paths in the database, the images can come from
everywhere. (That is a different and easier solution by the way)

\\\For the database the standard Northwind sample database.
\\\It needs 2 forms with a listbox, a picturebox and a label on form1
\\\webform1
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then
Dim conn As New SqlClient.SqlCo nnection _
("Server=(Local ); DataBase=Northw ind;" & _
"Integrated Security=SSPI")
Dim da As New SqlClient.SqlDa taAdapter _
("SELECT FirstName, EmployeeID FROM Employees", conn)
Dim ds As New DataSet
Me.Image1.Visib le = False
ListBox1.AutoPo stBack = True
Try
da.Fill(ds)
ListBox1.DataSo urce = ds.Tables(0)
ListBox1.DataTe xtField = "FirstName"
ListBox1.DataVa lueField = "EmployeeID "
ListBox1.DataBi nd()
Catch sqlExc As SqlClient.SqlEx ception
Me.Label1.Text = sqlExc.ToString
Catch exc As Exception
Me.Label1.Text = exc.ToString
End Try
End If
End Sub
Private Sub ListBox1_Select edIndexChanged( ByVal sender _
As System.Object, ByVal e As System.EventArg s) _
Handles ListBox1.Select edIndexChanged
Session.Item("i mg") = ListBox1.Select edItem.Value
Image1.Visible = True
Image1.ImageUrl = "http://localhost/TestWebImage/WebForm2.aspx"
'This is the location of the aspx files
End Sub
///
\\\webform2 watch that the Memstream, which is for Northwind
'the normal code is as well in it.
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim conn As New SqlClient.SqlCo nnection("Serve r=(Local);" & _
"DataBase=North wind; Integrated Security=SSPI")
Dim sqlstr As String = _
String.Format(" SELECT Photo FROM Employees WHERE (EmployeeID =
{0})", _
CInt(Session.It em("img")))
Dim cmd As New SqlClient.SqlCo mmand(sqlstr, conn)
conn.Open()
Dim rdr As SqlClient.SqlDa taReader = cmd.ExecuteRead er()
rdr.Read()
Dim arrImage() As Byte = DirectCast(rdr. Item("Photo"), Byte())
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''
'Dim ms1 As New System.IO.Memor yStream(arrImag e)
'The one above is for normal purpose, however Northwint has a
strange format
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '''''''''
Dim ms1 As New System.IO.Memor yStream(arrImag e, 78,
arrImage.Length - 78)
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''
Dim origimage As System.drawing. Image =
System.Drawing. Image.FromStrea m(ms1)
Dim PThumbnail As System.drawing. Image
PThumbnail = origimage.GetTh umbnailImage(10 0, 100, Nothing, New
IntPtr)
Dim ms2 As New System.IO.Memor yStream
PThumbnail.Save (ms2, Imaging.ImageFo rmat.Bmp)
arrImage = ms2.GetBuffer
Response.Binary Write(arrImage)
rdr.Close()
conn.Close()
End Sub
///

I hope this helps,

Cor
Nov 17 '05 #2
Zen
It's easy to retrieve image from other sites and save them on disk.

To manage image and use database, please check out
www.aspsimply.com/aspnet/ImageDBASPX.aspx
www.aspsimply.com/aspnet/Thumbnail.aspx
www.aspsimply.com/vbnet/ImageDB.aspx

Zen

"news.microsoft .com" <jt****@gmail.c om> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi, I am pretty new to ASP.net

I want to do the following but I have been unable to find good info/ or
sample code on it; please help;

- retrieve a gif/jpeg image using ASP.net from another site

- using ASP.net (Visual Basic.net or C#) code I want to edit the image by
superimposing a smaller image on the lower right hand corner

- then display the image to the user

- if possible, store the image to MySQL server

Thank you in advance. and please be as detail as you like.

Joe.

Nov 17 '05 #3

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

Similar topics

9
3332
by: Pierre Tremblay | last post by:
Hi! I am trying to display an image in my html document. The document contains the following line: <td class="Input"><img src=getimage.php?tbl=dbo.Employees&type=jpg&col=Photo&idCol=EmployeeID&id=1 Border=0 alt=''>&nbsp;</td>
5
2601
by: news | last post by:
Hi, I am pretty new to PHP I want to do the following but I have been unable to find good info/ or sample code on it; please help; - retrieve a gif/jpeg image using PHP from another site - using PHP code I want to edit the image by superimposing a smaller image on the lower right hand corner
2
3489
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button with image populate.gif? When I click p1 or p2 button, it will post the page to process.asp. 2) When I check the checkbox, I want the image in...
2
1146
by: news.microsoft.com | last post by:
Hi, I am pretty new to ASP.net I want to do the following but I have been unable to find good info/ or sample code on it; please help; - retrieve a gif/jpeg image using ASP.net from another site - using ASP.net (Visual Basic.net or C#) code I want to edit the image by superimposing a smaller image on the lower right hand corner
4
2682
by: Jake | last post by:
Does cookieless session state (with the sessionid embedded into the url) interfere with the browser's retrieval of cached images from one session to the next? Does the sessionid embedded into the url effectively limit client-side image caching to the lifetime of the session? Thanks Jake
7
2277
by: BluDog | last post by:
Hi I am trying to store an image in an xml file, i vcan store it fine but the retreval is a bit of a problem: To String: Dim ms As New IO.MemoryStream Dim arrImage() As Byte Me.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
3
5229
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add...
6
6405
by: Daniel Fetchinson | last post by:
Hi all, There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a...
21
1550
by: DP | last post by:
Hi, I'm not sure if this is the right group to ask. I am developing a small image library and I don't know how to hide the actual path to the image. So I go to the stock photo library websites to see how they hide their images. This is what I see from gettyimages.com <img src="http://cache2.asset-cache.net/xc/200186170-001.jpg?...
0
7700
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...
0
7614
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...
0
7924
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. ...
0
8125
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...
1
5513
isladogs
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...
0
5219
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...
1
2114
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
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.