resize image using aspjpeg

i have this image path in my database and i have aspjpeg installed in my web server

<%=(Recordset1.Fields.Item("image").Value)%>

how can i use aspjpeg so i will display a smaller version of my image.   i really do not need to save the thumbnail if it is possible.  
LVL 1
gianitooAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aprestoCommented:
0
gianitooAuthor Commented:
great but....in that case it creates a picture called thumbnail.

i would like to have this database driven

mypath=<%=(Recordset1.Fields.Item("image").Value)%>

so what would be the path for my dynamic thumbnail

<%
'create an instance of our object
Set thumbs = CreateObject("Persits.Jpeg")
'this is the path to your image or directory of images e.g

ImagePath = <%=(Recordset1.Fields.Item("image").Value)%>
'open the image
thumbs.Open ImagePath
' resize the image
thumbs.Width = thumbs.OriginalWidth / 3
thumbs.Height = thumbs.OriginalHeight / 3
'save the thumbnail version
thumbs.Save Server.MapPath("thumbnail.jpg")
%>

 
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

aprestoCommented:
i sorry gianitoo i have no idea
0
masirofCommented:
This code opens image, resizes proportionally setting a max of 100 pixel to the longer side of width or height.
And it doesnt save thumbnails, it just sends it to client. Of course image size decreases too.

<%
Set jpeg = Server.CreateObject("Persits.Jpeg")

jpeg.Open(Recordset1.Fields.Item("image").Value)

If jpeg.OriginalHeight < jpeg.OriginalWidth Then
      jpeg.Width = 100
      jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
Else
      jpeg.Height = 100
      jpeg.Width = jpeg.OriginalWidth * jpeg.Height / jpeg.OriginalHeight
End If

jpeg.SendBinary
%>
0
gianitooAuthor Commented:
i am getting this error
Persits.Jpeg.1 error '800a0002'

The system cannot find the path specified.

/papa/coupon.asp, line 78


and in my database  the picture is located in this path     papa/coupons/321-04-0473-0.jpg
0
masirofCommented:
Sure,

You should write out path like you are just

<img src="papa/coupons/321-04-0473-0.jpg">

or let us know where your page resides and images.. Directory structure..
0
gianitooAuthor Commented:
page is located in a folder called  papa

so you can find the page here  http://www.soccerbydesign.com/papa/coupon.asp
the image is located in a folder coupons  so you can find the image here
http://www.soccerbydesign.com/papa/coupons/321-04-0473-0.jpg
0
masirofCommented:
Okey,

try this then :

jpeg.Open("../" & Recordset1.Fields.Item("image").Value)
0
gianitooAuthor Commented:
when i try this   <img src="<%=(Recordset1.Fields.Item("image").Value)%>">

the image loads perfect

when when i add the code for aspjpg  it creates that annoying error
0
masirofCommented:
Ah yea, sorry. We should show it exact physical path..

You can use this :

jpeg.Open(Server.Mappath("../") & Recordset1.Fields.Item("image").Value)
0
gianitooAuthor Commented:
now i get no error but i get a horrible scribble instead of the thubnail

see on link below
http://www.soccerbydesign.com/papa/coupon.asp
0
gianitooAuthor Commented:
The support guy from aspjpg   tellsme that i need to send  
You need to send an image using a separate script, like this
 
<IMG SRC="script.asp">
 
and script.asp will actually create the thumbnail.

how do i do this?
0
masirofCommented:
actually the code should be in script.asp, the code I sent to you..

And then you call it from img src="script.asp" or thumbnaail asp..

and of course you may send query parameters to like
<img src="script.asp?imagename=<%=(Recordset1.Fields.Item("image").Value)%>">

thus you will have this code in script.asp

<%
Set jpeg = Server.CreateObject("Persits.Jpeg")

jpeg.Open(Server.Mappath("../") & Request.QueryString("imagename"))

If jpeg.OriginalHeight < jpeg.OriginalWidth Then
     jpeg.Width = 100
     jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
Else
     jpeg.Height = 100
     jpeg.Width = jpeg.OriginalWidth * jpeg.Height / jpeg.OriginalHeight
End If

jpeg.SendBinary
%>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gianitooAuthor Commented:
bingo
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.