Link to home
Start Free TrialLog in
Avatar of coreybryant
coreybryantFlag for United States of America

asked on

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
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

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

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

Might be better?

FtB
Avatar of coreybryant

ASKER

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
Okay, then do you have the 02_sendbinary.asp page in your directory?

FtB
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
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

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

FtB
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
Okay. Is the directory structure different on the two servers?

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

-Corey
SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Still nothing...  I left it on the shimmer if you want to take a look.  The parsed paths look the same

-Corey
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
Okay, when I check this path, the image is indeed there:

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

ftB
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
Perhaps it is this line that is failing:

Server.CreateObject("Persits.Jpeg")


FtB
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
But that is on a different server?

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

-Corey
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
%>
Yes it does: http://www.loudworx.com/aspjpg.asp :)

(leave it to me to always stump you) LOL

-Corey
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
%>
but your server is not loudworx?

FtB
@appari--

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

FtB
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
yes my server is loudworx.   And loudworx is on the same server as shimmer.  

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

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

FtB
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.

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

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

i dont this so-->  i dont think so
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
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
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
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.
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.
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
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
%>
hm getting somewhere :)  I commented jpeg.PreserveAspectRatio = True out

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

-Corey
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

now http://www.shimmerlighting.com/ seems working properly
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

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
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
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
I am glad that you have this sorted out.

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

-Corey