ASPImage Saving Problem (not a faq)

Discussion in 'Classic ASP' started by skoeld, Aug 25, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I've written a little resizing script, which doesn't produce any errors, however the new file is not saved.
    Funny enough, if I save the file under the same name and then load it in another page again, the .MaxX property does give me the new dimension, the picture itself looks the same though (despite me having emptied the browser cache completely and also having downloaded the file via ftp and double checked it).
    If I rename the file before saving it, I still don't get an error message, put the file is not generated.

    Here is my asp script:

    '#################################################
    filename =Trim(Request.Form("resizefile2"))
    path="upload"
    Xmax = 100
    Ymax = 100

    Set objImage = Server.CreateObject("AspImage.Image")
    objImage.ImageFormat = 1
    objImage.PixelFormat = 6

    if objImage.LoadImage("/"&path&"/"&filename) then
    Response.Write("Loading succesfull!")
    Response.Write("original X: "&objImage.MaxX &"original Y: "&objImage.MaxY&"")

    'calculate new dimension
    '----------------------------
    tempx = int(objImage.MaxX)
    tempy = int(objImage.MaxY)
    if (tempx=> tempy ) then
    ratio = Xmax/tempx
    else
    ratio = Ymax/tempy
    end if
    Response.Write("tempX: "&tempx &" tempy: "&tempy&"")

    tempx = int(tempx*ratio)
    tempy = int(tempy*ratio)
    '----------------------------

    ' resample picture
    '----------------------------
    objImage.ResizeR tempx,tempy
    Response.Write("new X: "&tempx &"new y: "&tempy&"")
    '----------------------------

    ' save picture
    '----------------------------
    filename="thumb_"&filename
    objImage.Filename = "/"&path&"/"&filename
    Response.Write(objImage.Filename&"")
    if objImage.SaveImage then
    Response.Write("Saving succesfull!")
    set objImage = nothing
    else
    Response.Write("Saving failed: "&objImage.Error&"")
    end if
    '----------------------------

    else
    'loading error
    '----------------------------
    Response.Write("Loading failed: "&objImage.Error&"")
    set objImage = nothing
    '----------------------------
    end if


    ' load picture into page
    '----------------------------
    Response.Write("<img name='' src='"&path&"/"&filename&" alt=''>
    ")
    '################################################
     
  2. I think you need to use the physical path, as in e:\whatever\directory\pic.jpg
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page