[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Cannot find a path

Posted on 2005-05-11
50
Medium Priority
?
650 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:coreybryant
  • 19
  • 19
  • 12
50 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982491
Ordinarily, you don't include a .asp page in the image path...

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

Might be better?

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13982517
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982569
Okay, then do you have the 02_sendbinary.asp page in your directory?

FtB
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982602
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13982625
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982631
Okay, in the 02_sendbinary.asp, how is the path set?

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13982641
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982753
Okay. Is the directory structure different on the two servers?

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13982776
No..  As fas I know - no.   They uploaded the entire website so I would not think they would change anything

-Corey
0
 
LVL 46

Assisted Solution

by:fritz_the_blank
fritz_the_blank earned 800 total points
ID: 13982811
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13982865
Still nothing...  I left it on the shimmer if you want to take a look.  The parsed paths look the same

-Corey
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982872
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982876
Okay, when I check this path, the image is indeed there:

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

ftB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982887
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13982888
Perhaps it is this line that is failing:

Server.CreateObject("Persits.Jpeg")


FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13982943
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983073
But that is on a different server?

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13983077
No - one the same server. (I only have one web server right now :) )

-Corey
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983153
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13983163
Yes it does: http://www.loudworx.com/aspjpg.asp :)

(leave it to me to always stump you) LOL

-Corey
0
 
LVL 39

Expert Comment

by:appari
ID: 13983170
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983176
but your server is not loudworx?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983178
@appari--

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

FtB
0
 
LVL 39

Expert Comment

by:appari
ID: 13983181
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13983184
yes my server is loudworx.   And loudworx is on the same server as shimmer.  

-Corey
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13983190
@ aparia...  Sorry that did not work either: http://www.shimmerlighting.com/ 

-Corey
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983192
Is there any reason why that component might not be accessible to that domain?

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13983202
0
 
LVL 39

Expert Comment

by:appari
ID: 13983214
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983218
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
 
LVL 39

Expert Comment

by:appari
ID: 13983219

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

Expert Comment

by:appari
ID: 13983227
0
 
LVL 39

Expert Comment

by:appari
ID: 13983232

i dont this so-->  i dont think so
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13983233
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13983234
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13983242
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
 
LVL 39

Expert Comment

by:appari
ID: 13983255
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
 
LVL 39

Expert Comment

by:appari
ID: 13983265
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13983279
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
 
LVL 39

Expert Comment

by:appari
ID: 13983283
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13983284
hm getting somewhere :)  I commented jpeg.PreserveAspectRatio = True out

-Corey
0
 
LVL 29

Author Comment

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

-Corey
0
 
LVL 39

Accepted Solution

by:
appari earned 1200 total points
ID: 13983312
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
 
LVL 39

Expert Comment

by:appari
ID: 13983326

now http://www.shimmerlighting.com/ seems working properly
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13983383
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
 
LVL 39

Expert Comment

by:appari
ID: 13983485

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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13985954
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
 
LVL 29

Author Comment

by:coreybryant
ID: 13986028
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
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13986061
I am glad that you have this sorted out.

FtB
0
 
LVL 29

Author Comment

by:coreybryant
ID: 13986090
Me to.  It took a lot of time.  and with y'alls help - it seems to work!

-Corey
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question