Snapshot and thumnail of web page
Techniques
This category is aimed to help programmers in order to find and share helpfull techniques, source code and more stuff.
Techniques / Web tools : DypsWebCapture : Capture thumbnail of an URL and store it in database
Documentation: DypsWebCapture object reference <
Previous Page
- Step 1 : Create the database
First we going to create an Access database, called thumbsBase.mdb .
Add a table named : Files.
Then we will have to add 3 fields to this table :
- Fieldname : FileName, Data type : Text
- Fieldname : FileData, Data type : Objet OLE (Image)
- Fieldname : Description, Data type : Text
- Step 2 : Capture the URL to image and store it in database
For this second step, we will write a script in order to capture a remote URL as image with this following script:
<%
Set Snap=server.CreateObject("DypsWebCapture.Snapshot")
'Launch a virtual browser window with the dimension :800x600
Snap.pageHeight =600
Snap.pageWidth = 800
'Specify the width and height of the image thumnail
Snap.thumbHeight = 130
Snap.thumbWidth = 170
'Grab the web page snapshot on the fly!
'and save it as jpg image
'Be sure to have write permission on the local folder
'for IUSR_YourNameMachine account!
Dim out
out = Snap.GetImageBytes ("http://dypso.free.fr","*.jpg")
'Clean memory
Set Snap = Nothing
' Connection string
Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
connStr = connStr & Server.MapPath("thumbsBase.mdb")
' Recordset object
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Files", connStr, 2, 2
' Adding data
rs.AddNew
rs("FileName") = "dypso.jpg"
rs("FileData").AppendChunk out
rs("Description") = "A thumbnail of Dypso BackOffice"
rs.Update
rs.Close
Set rs = Nothing
Response.Write "File was saved..."
%>
That's all the image is now stored in database as binary content !
Here is the final result in database :
Documentation: DypsWebCapture object reference <
Previous Page



