Page 1 of 1

COM+ & asp: image location problem

Posted: 2009-03-19T02:43:09-07:00
by tomaz
Hi

I have a small sub which resizes an uploaded picture to max 210x210.

when i provide the image location in a logic way, it works without any problem
for example:
Resize = Img.Convert("convert:","-resize","210x","d:/inetpub/wwwroot/WEBSITE/content/ProductInformation/" + IdtArticle + ".jpg", "d:/inetpub/wwwroot/WEBSITE/content/ProductInformation/" + IdtArticle + ".jpg")


but i'm programming this function, so it works on each site.
sometimes the inetpub is on the c-drive. and the website-name is each time a different name.

so i would need relative image locations as follow:

\content\productinformation?
../../content/productinformation?

my page where i do the upload is in the root of the website (inetpub/wwwroot/WEBSITE/)
the include file where my function is saved, has following location (inetpub/wwwroot/WEBSITE/scriptlibrary)

I searched this inquiry on internet, but can only find examples with the logic location.

Could somebody please help me out?

Thanks in advance





Sub ResizeFoto (IdtArticle)
' Variable declaration
Dim Img
Dim Resize
' Functionality
Set Img = Server.CreateObject("ImageMagickObject.MagickImage.1")
Resize = Img.Convert("convert:","-resize","210x","/content/ProductInformation/" + IdtArticle + ".jpg", _
"/content/ProductInformation/" + IdtArticle + ".jpg")
Set Img = Nothing
Set Resize = Nothing
End Sub ' of ResizeFoto

Re: COM+ & asp: image location problem

Posted: 2009-03-19T03:07:46-07:00
by tomaz
with server.mappath I can resolve some difficulties, but I don't know how to find the name of the website.

eg:


Server.MapPath("..\content\ProductInformation\"&IdtArticle&".jpg")

results:

d:\inetpub\wwwroot\content\ProductInformation\1241152000.jpg

so between wwwroot & content, there should be the website name.

thanks in advance

Re: COM+ & asp: image location problem

Posted: 2009-03-24T03:02:04-07:00
by tomaz
grmblz...

not that much feedback.

I'll give the solution myself; for further people who need an answer:

Code: Select all

 Request.Servervariables("APPL_PHYSICAL_PATH")+"content\ProductInformation\"

Greetings