Images Not Displaying

Discussion in 'ASP General' started by Mark Sargent, Oct 28, 2003.

  1. Mark Sargent

    Mark Sargent Guest

    Hi All,

    response.write FilePath gives this path, ImageName.jpeg but the image(s)
    doesn't display in the below code. What am I missing..? Cheers.

    <%Response.Write FilePath%>
    Original Image:<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>

    Thumbnail (50% reduction):<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">

    The files definitely exist in the database.

    Mark Sargent.
     
    Mark Sargent, Oct 28, 2003
    #1
    1. Advertising

  2. Mark Sargent

    Mark Sargent Guest

    sorry, that should read, on the harddrive, not in the database...cheers...
     
    Mark Sargent, Oct 28, 2003
    #2
    1. Advertising

  3. View source of the page generated and see what the output is coming out as.
    It may be you are missing the \ before imageuploads, but without the source
    it's difficult to say. Depends also the value of Filepath as well.

    Stu

    "Mark Sargent" <> wrote in message
    news:#...
    > Hi All,
    >
    > response.write FilePath gives this path, ImageName.jpeg but the image(s)
    > doesn't display in the below code. What am I missing..? Cheers.
    >
    > <%Response.Write FilePath%>
    > Original Image:<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>
    >
    > Thumbnail (50% reduction):<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">
    >
    > The files definitely exist in the database.
    >
    > Mark Sargent.
    >
    >
     
    Stuart Palmer, Oct 28, 2003
    #3
  4. Mark Sargent

    Steven Burn Guest

    I recently had this problem when converting part of my site and found the
    cause to be in the Server.MapPath code

    I had it as ./ (which it was previously as the main pages for them were in
    the same folder as the images) and as I had the new pages in a sub-folder of
    the root, I had to change it to ../path/sub-folder instead. I could be wrong
    but, it would seem that Server.MapPath is unable to interpret sub-folder
    paths normally used in image tags etc. (atleast, because of the problem I
    experienced and the only way I found to solve it..... gives me that
    impression).

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part :eek:)


    Mark Sargent <> wrote in message
    news:#...
    > Hi All,
    >
    > response.write FilePath gives this path, ImageName.jpeg but the image(s)
    > doesn't display in the below code. What am I missing..? Cheers.
    >
    > <%Response.Write FilePath%>
    > Original Image:<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>
    >
    > Thumbnail (50% reduction):<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">
    >
    > The files definitely exist in the database.
    >
    > Mark Sargent.
    >
    >
     
    Steven Burn, Oct 28, 2003
    #4
  5. Mark Sargent

    Mark Sargent Guest

    Hi All,

    k, the images are found via this path,
    rootfolder\Classifieds\ImageUploads\ImageName.jpeg..FilePath =
    ImageName.jpeg without a preceeding \. Would only need a preceeding ../ if
    the start folder was one folder above....still stumped. Cheers.

    Mark Sargent.
     
    Mark Sargent, Oct 28, 2003
    #5
  6. Mark Sargent

    Mark Sargent Guest

    full code below...cheers...

    <HTML>
    <HEAD>
    <TITLE>AspJpeg - Simple.asp</TITLE>
    </HEAD>
    <BODY>
    <%
    Dim FilePath
    if Request.QueryString("FilePath") <> "" then
    FilePath = Request.QueryString("FilePath")
    End If
    Response.Write FilePath
    %>
    <%
    ' Create instance of AspJpeg
    Set Jpeg = Server.CreateObject("Persits.Jpeg")

    ' Compute path to source image
    Path = Server.MapPath(FilePath)

    ' Open source image
    Jpeg.Open Path

    ' Decrease image size by %
    Jpeg.Width = Jpeg.OriginalWidth / 1.1
    Jpeg.Height = Jpeg.OriginalHeight / 1.1

    ' Apply sharpening if necessary
    ' Jpeg.Sharpen 1, 130

    ' create thumbnail and save it to disk
    FilePath = Replace(FilePath, "/", "\")
    FilePath = Replace(FilePath, "ImageUploads\", "")
    Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath


    %>
    <%Response.Write FilePath%>
    Original Image:<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>

    Thumbnail (% reduction):<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>"><P>
    </BODY>
    </HTML>


    The created thumbnail is being saved to the harddrive no problems...cheers..

    Mark Sargent.
     
    Mark Sargent, Oct 28, 2003
    #6
  7. Mark Sargent

    Steven Burn Guest

    Just a guess here but, you've said FilePath = the filename?. Are you adding
    a \ between the path and the filename?

    e.g. Server.MapPath("ImageUploads\Thumbs\Thumb") & "\" & FilePath

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part :eek:)


    Mark Sargent <> wrote in message
    news:#...
    > full code below...cheers...
    >
    > <HTML>
    > <HEAD>
    > <TITLE>AspJpeg - Simple.asp</TITLE>
    > </HEAD>
    > <BODY>
    > <%
    > Dim FilePath
    > if Request.QueryString("FilePath") <> "" then
    > FilePath = Request.QueryString("FilePath")
    > End If
    > Response.Write FilePath
    > %>
    > <%
    > ' Create instance of AspJpeg
    > Set Jpeg = Server.CreateObject("Persits.Jpeg")
    >
    > ' Compute path to source image
    > Path = Server.MapPath(FilePath)
    >
    > ' Open source image
    > Jpeg.Open Path
    >
    > ' Decrease image size by %
    > Jpeg.Width = Jpeg.OriginalWidth / 1.1
    > Jpeg.Height = Jpeg.OriginalHeight / 1.1
    >
    > ' Apply sharpening if necessary
    > ' Jpeg.Sharpen 1, 130
    >
    > ' create thumbnail and save it to disk
    > FilePath = Replace(FilePath, "/", "\")
    > FilePath = Replace(FilePath, "ImageUploads\", "")
    > Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath
    >
    >
    > %>
    > <%Response.Write FilePath%>
    > Original Image:<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>
    >
    > Thumbnail (% reduction):<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>"><P>
    > </BODY>
    > </HTML>
    >
    >
    > The created thumbnail is being saved to the harddrive no

    problems...cheers..
    >
    > Mark Sargent.
    >
    >
     
    Steven Burn, Oct 28, 2003
    #7
  8. Mark Sargent

    Mark Sargent Guest

    why would I need that..? FilePath = the path minus ImageUploads/ which you
    would see in the full code post. Here is how it's done, step by step...the
    path passed to the page is, ImageUpoads/FileName.jpeg. I then replace / with
    \ to pull the image from the drive. I then remove the path, ImageUploads\
    which just leaves the image name and then save as a Thumbnail. I then want
    to show the original and the created/saved Thumbnail before continuing to
    delete the un-needed original and subsequently addng the Thumbnail path into
    the Database. Hope that makes sense. Perhaps someone will have a quicker,
    more efficient way of doing all this, just this is the best I could imagine
    so far. Cheers.

    Mark Sargent.
     
    Mark Sargent, Oct 28, 2003
    #8
  9. Mark Sargent

    Mark Sargent Guest

    Hi All,

    K, perhaps I didn't explain myself well enuff. The original file is being
    resized and the thumb is being created and saved to the drive. The below
    code doesn't seem to write the image to the browser, though. FilePath = just
    the file name(original), example, MyPic.jpeg, which would be found here,
    ImageUploads\MyPic.jpeg, on the drive. Why is this not working..? Cheers.

    Mark Sargent.


    <%Response.Write FilePath & "<br>"%>
    Original Image:<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>

    Thumbnail (% reduction):<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">

    Below is the code used to save the thumb,

    FilePath = Replace(FilePath, "ImageUploads/", "")
    Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath
     
    Mark Sargent, Nov 5, 2003
    #9
  10. what does the html output look like for this line?

    Stu

    "Mark Sargent" <> wrote in message
    news:...
    > Hi All,
    >
    > K, perhaps I didn't explain myself well enuff. The original file is being
    > resized and the thumb is being created and saved to the drive. The below
    > code doesn't seem to write the image to the browser, though. FilePath =

    just
    > the file name(original), example, MyPic.jpeg, which would be found here,
    > ImageUploads\MyPic.jpeg, on the drive. Why is this not working..? Cheers.
    >
    > Mark Sargent.
    >
    >
    > <%Response.Write FilePath & "<br>"%>
    > Original Image:<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P>
    >
    > Thumbnail (% reduction):<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">
    >
    > Below is the code used to save the thumb,
    >
    > FilePath = Replace(FilePath, "ImageUploads/", "")
    > Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath
    >
    >
     
    Stuart Palmer, Nov 5, 2003
    #10
  11. Mark Sargent

    Mark Sargent Guest

    just shows the broken image icon...cheers..

    Mark Sargent.
     
    Mark Sargent, Nov 5, 2003
    #11
  12. Mark Sargent

    Mark Sargent Guest

    now, now, young Raymond, no need to get snippet...lol...k,
    understood..cheers.

    Mark Sargent.
     
    Mark Sargent, Nov 5, 2003
    #12
  13. Mark Sargent

    Ray at Guest

    I think he meant the html snippet from a view source...

    Ray at work

    "Mark Sargent" <> wrote in message
    news:...
    > just shows the broken image icon...cheers..
    >
    > Mark Sargent.
    >
    >
     
    Ray at, Nov 5, 2003
    #13
  14. Mark Sargent

    Mark Sargent Guest

    <html>
    <head>
    <title>easyboarder - Image Resize</title>
    </head>
    <body>
    <div align="center">
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p>ImageUploads/JPSnakeJBayPro(28).jpg<br>JPSnakeJBayPro(28).jpg<br>
    Original Image:<br>
    <img SRC="C:\Documents and Settings\wombat\My
    Documents\easyboarder\wwwroot\Classifieds\ImageUploadsJPSnakeJBayPro(28).jpg
    "></p></div>
    <p align="center"> Thumbnail (% reduction):<br>
    <img SRC="C:\Documents and Settings\wombat\My
    Documents\easyboarder\wwwroot\Classifieds\ImageUploads\Thumbs\ThumbJPSnakeJB
    ayPro(28).jpg">
    <p align="center">
    </body>
    </html>
     
    Mark Sargent, Nov 5, 2003
    #14
  15. Mark Sargent

    Steven Burn Guest

    aah, I can hear Loraina already ;o)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Sargent <> wrote in message
    news:...
    > now, now, young Raymond, no need to get snippet...lol...k,
    > understood..cheers.
    >
    > Mark Sargent.
    >
    >
     
    Steven Burn, Nov 5, 2003
    #15
  16. Mark Sargent

    Steven Burn Guest

    "C:\Documents and Settings\wombat\My
    Documents\easyboarder\wwwroot\Classifieds\ImageUploadsJPSnakeJBayPro(28).jpg
    "

    Look at the end of the path.

    \ImageUploadsJPSnakeJBayPro(28).jpg

    there's no \ between ImageUploads and the filename

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Sargent <> wrote in message
    news:#...
    >
    > <html>
    > <head>
    > <title>easyboarder - Image Resize</title>
    > </head>
    > <body>
    > <div align="center">
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p>ImageUploads/JPSnakeJBayPro(28).jpg<br>JPSnakeJBayPro(28).jpg<br>
    > Original Image:<br>
    > <img SRC="C:\Documents and Settings\wombat\My
    >

    Documents\easyboarder\wwwroot\Classifieds\ImageUploadsJPSnakeJBayPro(28).jpg
    > "></p></div>
    > <p align="center"> Thumbnail (% reduction):<br>
    > <img SRC="C:\Documents and Settings\wombat\My
    >

    Documents\easyboarder\wwwroot\Classifieds\ImageUploads\Thumbs\ThumbJPSnakeJB
    > ayPro(28).jpg">
    > <p align="center">
    > </body>
    > </html>
    >
    >
     
    Steven Burn, Nov 5, 2003
    #16
  17. Mark Sargent

    Steven Burn Guest

    Try;

    FilePath = "\" & filename (where filename is whatever your using for the
    filenames)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Sargent <> wrote in message
    news:#...
    >
    > <html>
    > <head>
    > <title>easyboarder - Image Resize</title>
    > </head>
    > <body>
    > <div align="center">
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p>ImageUploads/JPSnakeJBayPro(28).jpg<br>JPSnakeJBayPro(28).jpg<br>
    > Original Image:<br>
    > <img SRC="C:\Documents and Settings\wombat\My
    >

    Documents\easyboarder\wwwroot\Classifieds\ImageUploadsJPSnakeJBayPro(28).jpg
    > "></p></div>
    > <p align="center"> Thumbnail (% reduction):<br>
    > <img SRC="C:\Documents and Settings\wombat\My
    >

    Documents\easyboarder\wwwroot\Classifieds\ImageUploads\Thumbs\ThumbJPSnakeJB
    > ayPro(28).jpg">
    > <p align="center">
    > </body>
    > </html>
    >
    >
     
    Steven Burn, Nov 5, 2003
    #17
  18. Mark Sargent

    Mark Sargent Guest

    This code below,

    <%Response.Write FilePath & "<br>"
    ImagePath = Server.MapPath("ImageUploads") & "/" & FilePath
    ImagePath = Replace(ImagePath, "\", "/")
    Response.Write ImagePath & "<br>"%>
    Original Image:<BR>

    <IMG SRC="<%=ImagePath %>"></p></div>
    <P align="center"> Thumbnail (% reduction):<BR>
    <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">
    <P align="center">

    gives the source below,
    <html>
    <head>
    <title>easyboarder - Image Resize</title>
    </head>
    <body>
    <div align="center">
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>

    <p>ImageUploads/JPSnakeJBayPro(28).jpg<br>JPSnakeJBayPro(28).jpg<br>C:/Docum
    ents and Settings/wombat/My
    Documents/easyboarder/wwwroot/Classifieds/ImageUploads/JPSnakeJBayPro(28).jp
    g<br>
    Original Image:<br>

    <img SRC="C:/Documents and Settings/wombat/My
    Documents/easyboarder/wwwroot/Classifieds/ImageUploads/JPSnakeJBayPro(28).jp
    g"></p></div>
    <p align="center"> Thumbnail (% reduction):<br>
    <img SRC="C:\Documents and Settings\wombat\My
    Documents\easyboarder\wwwroot\Classifieds\ImageUploads\Thumbs\ThumbJPSnakeJB
    ayPro(28).jpg">
    <p align="center">
    </body>
    </html>
    cheersMark Sargent
     
    Mark Sargent, Nov 5, 2003
    #18
  19. Mark Sargent

    Steven Burn Guest

    Does that mean it's working now?

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group CEO
    www.it-mate.co.uk

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Mark Sargent <> wrote in message
    news:...
    > This code below,
    >
    > <%Response.Write FilePath & "<br>"
    > ImagePath = Server.MapPath("ImageUploads") & "/" & FilePath
    > ImagePath = Replace(ImagePath, "\", "/")
    > Response.Write ImagePath & "<br>"%>
    > Original Image:<BR>
    >
    > <IMG SRC="<%=ImagePath %>"></p></div>
    > <P align="center"> Thumbnail (% reduction):<BR>
    > <IMG SRC="<%=Server.MapPath("ImageUploads\Thumbs\Thumb") & FilePath%>">
    > <P align="center">
    >
    > gives the source below,
    > <html>
    > <head>
    > <title>easyboarder - Image Resize</title>
    > </head>
    > <body>
    > <div align="center">
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    > <p> </p>
    >
    >

    <p>ImageUploads/JPSnakeJBayPro(28).jpg<br>JPSnakeJBayPro(28).jpg<br>C:/Docum
    > ents and Settings/wombat/My
    >

    Documents/easyboarder/wwwroot/Classifieds/ImageUploads/JPSnakeJBayPro(28).jp
    > g<br>
    > Original Image:<br>
    >
    > <img SRC="C:/Documents and Settings/wombat/My
    >

    Documents/easyboarder/wwwroot/Classifieds/ImageUploads/JPSnakeJBayPro(28).jp
    > g"></p></div>
    > <p align="center"> Thumbnail (% reduction):<br>
    > <img SRC="C:\Documents and Settings\wombat\My
    >

    Documents\easyboarder\wwwroot\Classifieds\ImageUploads\Thumbs\ThumbJPSnakeJB
    > ayPro(28).jpg">
    > <p align="center">
    > </body>
    > </html>
    > cheersMark Sargent
    >
    >
     
    Steven Burn, Nov 5, 2003
    #19
  20. Mark Sargent

    Mark Sargent Guest

    no....
     
    Mark Sargent, Nov 5, 2003
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TXIce

    Images not displaying in designer

    TXIce, Dec 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    388
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 31, 2004
  2. buzz
    Replies:
    1
    Views:
    1,154
    =?Utf-8?B?Q3JhaWc=?=
    Aug 31, 2005
  3. Replies:
    2
    Views:
    441
  4. Woodmon

    Linked images not displaying

    Woodmon, Oct 21, 2005, in forum: HTML
    Replies:
    2
    Views:
    389
    Jukka K. Korpela
    Oct 21, 2005
  5. =?Utf-8?B?SmFtZXM=?=

    Images not displaying

    =?Utf-8?B?SmFtZXM=?=, May 26, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    1,792
Loading...

Share This Page