Hi Panchux, thanks for that but the real question is how to get aspjpeg to do it http://www.aspjpeg.com
Main Topics
Browse All TopicsHi there, I've downloaded aspjpeg and I'm trying to get it to save the file to my sql server database. At the moment I have worked out how to save an image to the disk and all the resizing and thumbnail bits but I can't figure out at which point I get to save the blob to the database and what happens to the thumbnail anyway.
There are the four asp files, pick_jpeg, thumbnail, send_binary and upload_jpeg but I'm stuck.
Has anyone got working code on how to get the job done and save the image, path, dimensions etc to the database?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Panchux, thanks for that but the real question is how to get aspjpeg to do it http://www.aspjpeg.com
ASPJpeg can open the images from the database... as far as saving them to the database I think that is the other half of their software called ASPUpload
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../db/aspj
Set rs = Server.CreateObject("adodb
SQL = "select image_blob from images2 where id = " & Request("id")
rs.Open SQL, strConnect, 1, 3
Set Jpeg = Server.CreateObject("Persi
' Open image directly from recordset
Jpeg.OpenBinary rs("image_blob").Value
' Resize
jpeg.Width = Request("Width")
' Set new height, preserve original aspect ratio
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
Jpeg.SendBinary
rs.Close
http://www.aspjpeg.com/man
What I mean is which of the asp files will I need to add this code to. Here is the link to the site with the aspjpeg pages http://support.persits.com
This is the code that goes nn the page that saves the image to the disk (this will then save it to the database). You will of course need a database with the fields img_blob, imgwidth & imgheight in and you will need to setup the database connection etc...
If you are stuck, then use dreamweaver to insert a record into the database you want to use (on the page that currently saves the picture into a file - use any values you like as we only want to see the connection string). If you then paste up the code dreamweaver produces I will be able to determine what your connection string is and provide you with fully working code that you can simply cut and paste.
will I be replacing
<%
Set Upload = Server.CreateObject("Persi
Upload.OverwriteFiles = False
Upload.SetMaxSize 5000000, True
Upload.CodePage = 65001
On Error Resume Next
Count = Upload.Save("\\nas43ent\do
If Err <> 0 or Count = 0 Then
%>
with this?
Set rs = Server.CreateObject("adodb
rs.Open "images", strConnect, 1, 3
rs.AddNew
rs("image_blob").Value = Jpeg.Binary
rs("imgheight").value = Jpeg.Height
rs("imgwidth").value = Jpeg.Width
rs.Update
If you replace those lines you will be saving the image into the DB instead of saving it to the disk.
It's the code I passed you but adding width and height. Only save those values if needed if you don't you will only get to increase the size of the DB.
You will need to change:
"images" with the name of the table containing your images
"strConnect" with the name of the variable containing the string connection.
"image_blob" with the name of the field which will contain the image
"imgheight" and "imgwidth" with the name of the fields which will contain the height and width of the image if needed
"Jpeg" if other name for the ASPJpeg object was used you need to change that too
Pancho
Business Accounts
Answer for Membership
by: PanchuxPosted on 2009-01-08 at 16:41:15ID: 23331773
I would rather prefer to store its name (sometimes is not really necesary) and store the image in the disk.
As far as I know this outperforms in performance saving the file into the DB.
For thumbnails I use same name but different path so I save only one name in DB.
i.e.
img path=./img name=car.jpg
thumb Path=./img/thumbs/ name=car.jpg
Hope that helps,
Pancho