Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Images Not Displaying

Reply
Thread Tools

Images Not Displaying

 
 
Mark Sargent
Guest
Posts: n/a
 
      10-28-2003
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.


 
Reply With Quote
 
 
 
 
Mark Sargent
Guest
Posts: n/a
 
      10-28-2003
sorry, that should read, on the harddrive, not in the database...cheers...


 
Reply With Quote
 
 
 
 
Stuart Palmer
Guest
Posts: n/a
 
      10-28-2003
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" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Steven Burn
Guest
Posts: n/a
 
      10-28-2003
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 )


Mark Sargent <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Mark Sargent
Guest
Posts: n/a
 
      10-28-2003
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.


 
Reply With Quote
 
Mark Sargent
Guest
Posts: n/a
 
      10-28-2003
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.


 
Reply With Quote
 
Steven Burn
Guest
Posts: n/a
 
      10-28-2003
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 )


Mark Sargent <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Mark Sargent
Guest
Posts: n/a
 
      10-28-2003
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.


 
Reply With Quote
 
Mark Sargent
Guest
Posts: n/a
 
      11-05-2003
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


 
Reply With Quote
 
Stuart Palmer
Guest
Posts: n/a
 
      11-05-2003
what does the html output look like for this line?

Stu

"Mark Sargent" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PP:Displaying Default Images when required does not exist prabhupr@hotmail.com ASP .Net 2 04-23-2006 05:19 PM
Linked images not displaying Woodmon HTML 2 10-21-2005 04:49 PM
ASP.NET user control not displaying images buzz ASP .Net 1 08-31-2005 06:56 PM
Images not displaying in designer TXIce ASP .Net 1 12-31-2004 04:57 AM
images not displaying on a subnet Jim PKP Computer Support 0 01-27-2004 05:04 PM



Advertisments