Cannot find a path

Currently I have:
<%
      Path = "upload/"&trim(rsn("picture"))
      'Path = Server.URLEncode(Server.MapPath(Path))
%>
<a href="products.asp?style=<%=rsn("StyleID")%>"><IMG border=0 SRC="02_sendbinary.asp?path=<% = Path%>"></a></td><td>

and in 02_sendbinary.asp:
<%
      Response.Expires = 0
      
      ' create instance of AspJpeg
      Set Jpeg = Server.CreateObject("Persits.Jpeg")
      
      ' Open source file
      Jpeg.Open( Request("path") )

jpeg.PreserveAspectRatio = True
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = 100
      Else
   jpeg.Height = 100
End If

      

      ' Perform resizing and
      ' send resultant image to client browser
      Jpeg.SendBinary
%>

Right now - all the images are in the upload folder - but it is not pulling the images.

Anything that I missed?

-Corey
LVL 29
coreybryantAsked:
Who is Participating?
 
appariCommented:
yes
now i can browse to http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/557AF45-75.jpg

but not properly scaled down.

try changing
<%
     Response.Expires = 0
     
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     'Jpeg.Open( Request("path") )
     Jpeg.Open( Server.MapPath(Request("path") ))

''''jpeg.PreserveAspectRatio = True
'If jpeg.OriginalWidth > jpeg.OriginalHeight Then
'   jpeg.Width = 100
'      Else
'   jpeg.Height = 100
'End If

' New width
L = 100

' Resize, preserve aspect ratio
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth


     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>

0
 
fritz_the_blankCommented:
Ordinarily, you don't include a .asp page in the image path...

<IMG border=0 SRC="<% = Path%>">

Might be better?

FtB
0
 
coreybryantAuthor Commented:
I tried that, but the code was working on another server..  So I know it should work :)  - plus if I remove that 02_sendbinary - the images are the orginal size :( - way too big

-Corey
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
fritz_the_blankCommented:
Okay, then do you have the 02_sendbinary.asp page in your directory?

FtB
0
 
fritz_the_blankCommented:
What I am thinking here is that the 02_sendbinary.asp page takes the image name as a parameter and returns a resized version. The path not found may mean that you are not pointing the .asp page or it doesn't exist.

FtB
0
 
coreybryantAuthor Commented:
Yes - that is in the same folder.  The images are in a folder called upload.  I have tried to change that path to
<%
      Path = "/upload/"&trim(rsn("picture"))
     'Path = Server.URLEncode(Server.MapPath(Path))
%>
and
<%
      Path = "upload/"&trim(rsn("picture"))
     Path = Server.URLEncode(Server.MapPath(Path))
%>
but still nothing.  Here is the site that is working (hosted somewhere else): http://www.aschandeliers.com/ and this one is not: http://www.shimmerlighting.com/ (hosted by me :( )

Thanks!

-Corey

0
 
fritz_the_blankCommented:
Okay, in the 02_sendbinary.asp, how is the path set?

FtB
0
 
coreybryantAuthor Commented:
I only have:
<%
     Response.Expires = 0
     
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     Jpeg.Open( Request("path") )

jpeg.PreserveAspectRatio = True
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = 100
      Else
   jpeg.Height = 100
End If

     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>
in that one..  

-Corey
0
 
fritz_the_blankCommented:
Okay. Is the directory structure different on the two servers?

FtB
0
 
coreybryantAuthor Commented:
No..  As fas I know - no.   They uploaded the entire website so I would not think they would change anything

-Corey
0
 
fritz_the_blankCommented:
What happens if you change this page as follows for troubleshooting:

<%
     Response.Expires = 0
     response.write ( Request("path") )
     response.end
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     Jpeg.Open( Request("path") )

jpeg.PreserveAspectRatio = True
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = 100
      Else
   jpeg.Height = 100
End If

     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>
0
 
coreybryantAuthor Commented:
Still nothing...  I left it on the shimmer if you want to take a look.  The parsed paths look the same

-Corey
0
 
fritz_the_blankCommented:
I am glad that you left it for me to see:

http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/557AF45-75.jpg

Now, let's see what is going on there...

ftB
0
 
fritz_the_blankCommented:
Okay, when I check this path, the image is indeed there:

http://www.shimmerlighting.com/upload/557AF45-75.jpg

ftB
0
 
fritz_the_blankCommented:
And the source looks fine:

<IMG border=0 SRC="02_sendbinary.asp?path=upload/557AF45-75.jpg"></a>


So, have you installed the component?

FtB
0
 
fritz_the_blankCommented:
Perhaps it is this line that is failing:

Server.CreateObject("Persits.Jpeg")


FtB
0
 
coreybryantAuthor Commented:
Yes we do have that installed: http://www.loudworx.com/test_asp_components.asp - actually have other clients using it so I know that is working..

-Corey
0
 
fritz_the_blankCommented:
But that is on a different server?

FtB
0
 
coreybryantAuthor Commented:
No - one the same server. (I only have one web server right now :) )

-Corey
0
 
fritz_the_blankCommented:
So this works:

<%
    Set Jpeg = Server.CreateObject("Persits.Jpeg")
    if isObject(Jpeg) then
       response.write("This is installed")
    else
      response.write("This is Not installed")
    end if
%>
0
 
coreybryantAuthor Commented:
Yes it does: http://www.loudworx.com/aspjpg.asp :)

(leave it to me to always stump you) LOL

-Corey
0
 
appariCommented:
may be Jpeg.Open expects physical path? try using Server.MapPath while opening the jpeg like

     Jpeg.Open( Server.MapPath(Request("path") ))


try the following changed code


<%
     Response.Expires = 0
     
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     'Jpeg.Open( Request("path") )
     Jpeg.Open( Server.MapPath(Request("path") ))

jpeg.PreserveAspectRatio = True
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = 100
      Else
   jpeg.Height = 100
End If

     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>
0
 
fritz_the_blankCommented:
but your server is not loudworx?

FtB
0
 
fritz_the_blankCommented:
@appari--

That's a good thought. Although, it didn't need that on the other server....

FtB
0
 
appariCommented:
yes it expects physical path, here is the copy method explanation from reference

Sub Open(Path As String)
     Opens a JPEG image for resizing. Path must be a physical path to the image.

http://www.aspjpeg.com/object_aspjpeg.html#Open
0
 
coreybryantAuthor Commented:
yes my server is loudworx.   And loudworx is on the same server as shimmer.  

-Corey
0
 
coreybryantAuthor Commented:
@ aparia...  Sorry that did not work either: http://www.shimmerlighting.com/ 

-Corey
0
 
fritz_the_blankCommented:
Is there any reason why that component might not be accessible to that domain?

FtB
0
 
coreybryantAuthor Commented:
0
 
appariCommented:
when i try to browse to
http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/557AF45-75.jpg its giving the error

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Jpeg.PreserveAspectRatio'

/02_sendbinary.asp, line 11

not the file not found error.

but when i browse to http://www.shimmerlighting.com and copy the address from the properties of first image(now no image displayed, simple red cross mark) the path is http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/61515-37.jpg it says file not found.

0
 
fritz_the_blankCommented:
This is very strange.


So the path looks like this now:

http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/CAL-P9642(2).jpg

Perhaps we need a / in front of upload?

FtB
0
 
appariCommented:

so in first case file exists and there is a different problem. second case image itself is not available. check it.
0
 
appariCommented:
0
 
appariCommented:

i dont this so-->  i dont think so
0
 
coreybryantAuthor Commented:
Check it out now - I took 02_sendbinary.asp?path= out - you will see some of the images are on the server (still working on that)..But you will see without that extra code - that it just is not good

-Corey
0
 
fritz_the_blankCommented:
The path looks very different on the other server:

http://www.aschandeliers.com/02_sendbinary.asp?path=G%3A%5Cwwwroot%5Caschandeliers%2Ecom%5Casuploads%5CSLC4980%281%29%2Ejpg

It looks like a physical rather than a virtual path.

FtB
0
 
coreybryantAuthor Commented:
Yes - they were actually sharing the images on BOTH websites.  They are moving hosting companies - and shimmer is the first one.  But that G: etc is all pulled form the ASP code :-/

-Corey
0
 
appariCommented:
ok when we try to browse to
http://www.shimmerlighting.com/02_sendbinary.asp?path=upload/CAL-P9642(2).jpg
(CAL-P9642(2).jpg is the 1st image that is displayed in your page in your chaged page.), its giving error Object doesn't support this property or method: 'Jpeg.PreserveAspectRatio' .

can you comment out line 11 in /02_sendbinary.asp and after chenging it post it here, we will check again.
0
 
appariCommented:
i think there are two problems.
1. few images are missing
2. even though image exists, becoz of "Object doesn't support this property or method: 'Jpeg.PreserveAspectRatio' " error they are displayed as image missing cross.
0
 
coreybryantAuthor Commented:
Line 11 in my orginal or yours?  I still have yours there right now.   (but right now - I am not even using the 02_sendbinary)

-Corey
0
 
appariCommented:
ok replace with this one

<%
     Response.Expires = 0
     
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     'Jpeg.Open( Request("path") )
     Jpeg.Open( Server.MapPath(Request("path") ))

''''jpeg.PreserveAspectRatio = True
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = 100
      Else
   jpeg.Height = 100
End If

     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>
0
 
coreybryantAuthor Commented:
hm getting somewhere :)  I commented jpeg.PreserveAspectRatio = True out

-Corey
0
 
coreybryantAuthor Commented:
It shows on their page: http://www.aspjpeg.com/manual_02.html#2_1 - it seems to be correct?

-Corey
0
 
appariCommented:

now http://www.shimmerlighting.com/ seems working properly
0
 
coreybryantAuthor Commented:
Well we are getting there.  if you want - call it a night :)  and I will have my programmer work on it when he gets up in a couple of hours :)

-Corey
0
 
appariCommented:

No problem, if you have any problem post it here,
i have to wait another 10-12 hours to say good night:), i am based in Tokyo
0
 
fritz_the_blankCommented:
I found the same thing--that when I put the paths in directly, the pictures were there.

However, these two paths loook very different. appari suggested earlier that a physical path might be necessary, and that is what it looks like on the second url:

<IMG border=0 SRC="02_sendbinary.asp?path=upload/557AF45-75.jpg"></a>

http://www.aschandeliers.com/02_sendbinary.asp?path=G%3A%5Cwwwroot%5Caschandeliers%2Ecom%5Casuploads%5CSLC4980%281%29%2Ejpg

What I would do is create a page called where.asp and put it in your root. The code should be this:

<%
response.write(Server.MapPath("where.asp"))
%>

Once you have the full physiical path, you can just add /upload/ to the end of it and then use that in your script. That should solve the problem.

FtB
0
 
coreybryantAuthor Commented:
Actually it seems to be working - amzing what a few beers and a good night sleep will do :) - here is what was added /  changed:
<%
     Response.Expires = 0
     
     
Set Image = Server.CreateObject("csImageFile.Manage")
Image.Readfile Server.MapPath(Request("path"))
if Image.width > Image.height then
      Image.Resize 100,0
else
      Image.Resize 0,100
end if
Response.ContentType = "Image/Jpeg"
Response.AddHeader "Content-Disposition", "inline; filename=img" & index & ".jpg"
Response.BinaryWrite Image.JPGData
set Image=nothing
response.end    
     
     ' create instance of AspJpeg
     Set Jpeg = Server.CreateObject("Persits.Jpeg")
     
     ' Open source file
     'Jpeg.Open( Request("path") )
     Jpeg.Open( Server.MapPath(Request("path") ))

''''jpeg.PreserveAspectRatio = True
'If jpeg.OriginalWidth > jpeg.OriginalHeight Then
'   jpeg.Width = 100
'      Else
'   jpeg.Height = 100
'End If

' New width
L = 100

' Resize, preserve aspect ratio
'Jpeg.PreserveAspectRatio = True
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth


     

     ' Perform resizing and
     ' send resultant image to client browser
     Jpeg.SendBinary
%>


-Corey
0
 
fritz_the_blankCommented:
I am glad that you have this sorted out.

FtB
0
 
coreybryantAuthor Commented:
Me to.  It took a lot of time.  and with y'alls help - it seems to work!

-Corey
0
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.

All Courses

From novice to tech pro — start learning today.