Testing To See If Image Exists Before Displaying It
I dont know if this is the right place to ask this but I have a database which contains shop details, each of which can have several images associated with it. In the database I am just storing the image paths, the actual images are held on a remote server.
I am able to grab the pathnames from the database and then use the following code to loop through the recordset displaying the associated image(s).
While NOT rs.EOF
Response.Write("<img src=""servernameImages" & rs.Fields(0) & """ width=""150"" height=""150"">")
rs.MoveNext
My question is, in the event of one of the images not being found, it just displays a red cross, is there any way of testing to see if the image exists before I try and display it?
View Replies
ADVERTISEMENT
Just wondering if someone could look at this and see where I may be going wrong. The basic concept is to use FileSystemObject to see if an image exists. If it does, display the image. If not, display image does not exists message.
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
strFilename = ="e:path oimageprodPixscienceTN" &
(RecordSet1.Fields.Item("ID").Value) & ".jpg"
If (fs.FileExists(strFilename))=true Then %>
<%=(Recordset1.Fields.Item("ID").Value)%>
<%
Else
Response.Write("No Image Available")
End If
set fs=nothing
%>
View Replies
View Related
I'm building some dynamic image links based on if the image file exists. How can I check 'if files exists' using asp or javascript? I've messed around some with FileSystemObject but so far no success.
View Replies
View Related
I am working on a image gallery and am trying to show images from different websites. Before I display an image I need to know whether that image exists on the other server and only display it if it exists.
View Replies
View Related
Does anyone know how I can check to see if an image exists on another web host? I tried using the file system object but it didn't seem to work. I think my problem is that I have to check a URL instead of an actual file path to see if something exists there.
View Replies
View Related
I am creating a dynamic ASP VBScript page, which gets data from an Access database.
In the database, there is a field which holds a URL to an image. I can get the image to display fine, but where there is no file that matches the URL (i.e. a missing image) I want to display an alternative, default image (e.g. one that says "Awaiting Image"). The field is never blank, but the image file may not exist for all records in the database.
I think what I am trying to get to is the following:
If file exists (using URL from database to get location of image file) then
display image using the url from the database as the image source
else
display default image - hardcoded in program
endif
I have had a go and come up with the attached but I get an error with my if statement...
View Replies
View Related
How do test my web application for concurrent users (how much concurent user connect at a time and how traffice will be affected and what will the response time?) and how it is done, how long it will takes, does it interfere with current site, etc.?
Reagarding the number of users the site will accomodate is it based on where it's hosted
Application written in ASP/Sql Server. Code:
View Replies
View Related
I'm sure I'm missing something completely obvious, but I can't figure out what. I have a path to an image file stored in a database. I'm trying to align the image to the right, but nothing seems to be working:
Response.Write("<img src='" & rs("faculty_link_to_photo") &"'>")
dispays the photo without any wrapping, but when I try the following, the images go all over the page:
Response.Write("<img align=""right"" src='" & rs("faculty_link_to_photo") &"'>")
Can someone tell me what I'm doing wrong?
View Replies
View Related
I have ASP (classic) code that writes out a table and sets the <img....> tag
with a virtual directory source, e.g. src='/test/imghold/xyz.png', and the
images do not appear on the IE page. The code is from a production site
that works fine.
We just duplicated the web site to one named test and now
the images do not display. The IMG item is in a TD element of a table.
Also, I looked at the "view source" of the page and it shows the <IMG
src='/test/imghold/xyz.png'...> just fine. I even tried it with different
images and none of them show up.
View Replies
View Related
It is not displaying the image thepicture. It is in the directory. I also have a similar bits of code for a other pictures with of and they is working The response write displays the correct reference.
The alt displays instead of the image as though the image has not been found and as I said the Code:
View Replies
View Related
I have to display tif images using .asp page. I have tried to read the image
as a binary file and stream it to the browser. The relevant code is as
follows. Unfortunately, the display on the browser is a lot of gobledygook.
How can I ensure that the image displays correctly in the browser? Code:
View Replies
View Related
The pic in the DB is just a named reference, as all the pics are stored in 2 common folders. 1 for the normal size pics and 1 for the thumbnail equivalents.
As this particular page has to be tight on space, I wanted to set the image as a percentage of it's size so I set the following:
<IMG SRC="thumbs/<%=picname%>' WIDTH="30%" HEIGHT=30%> etc....
Problem I have with this is that the browser seems to set all pics to 1 common percentage size rather than each being say 30% of each individual pic's size. This results in some piccies being completely distorted.
I don't want to go down the route of storing the x and y of each pic in the DB, so could you please let me know if I am doing something really stupid with the above.
View Replies
View Related
I have designed asp pages where all pages have common header and footer. I have added Images to the footer page called as footer.asp.
now i have the footer.asp in another folder
and i call that footer.asp within my index.asp page as a include page.
but the images in the footer.asp are not displaying in the index.asp.
what could be the problem?
View Replies
View Related
I wish to display an image from a folder based on the name held in a field in a database.
<%
If len(rssal("picture"))>0 then
Response.Write ("<img src=""/ProductImages/rssal("ProductCode").gif"">")
ELSE
Response.Write ("<img src=""images/sorry.gif"">")
END IF
%>
View Replies
View Related
An application is logging faxes sent in SQL2000 image column type. I have
found code on the net but what it is doing is prompting to save to local
which is fine for single page image. Not good for multiple page faxes. I
have not been able to locate an example to load in the browser or how to
handle multiple image in the one column. Code:
View Replies
View Related
The code sends an automatic email, but the email is html format. At the top of the email i want to include an image.
Everything is working except the image is not being included, instead a box with a X appears.
Here is the code that i am currently using
Dim htmlMess ' THIS STORES THE HTML CODE
PHP Code:
View Replies
View Related
I have a website that we display images we have saved into a SQL Server 2000 database as binary BLOB. This is on a Windows 2003 Server. Just recently (a week ago) this website began to save the images it is displaying on the website as ASP pages in the Temporary Internet Files > IE.Content > Folder.
We have other websites where we use the exact same code and these do not save files on the server when they are displayed.
Here is the code to display the image:
Set rs = objConn.Execute( SQL )
Response.ContentType = "application/octet-stream"
Response.BinaryWrite rs("Product_Image")
SQL is the SQL String to get the image from database
When I add this code:
Response.ContentType = "image/jpeg"
The images still display on the website, but now are saved in the Temporary Internet Files folder as JPG's.
View Replies
View Related
test my app? it's still in development but it's very much usable. i'm looking for few good object oriented souls that can look at this. i'm still adding few functions so don't be surprised if it goes down for a VERY short time (minutes really).
View Replies
View Related
I need to revisit cookie testing. On the home page and every product page I
write a cookie. I do this because some users enter by direct links to
product pages.
<%
Response.Cookies("cookietest") = ("49")
Response.Cookies("cookietest").Expires = Date + 2
%>
On the cart page I test for the cookie...
<%
If Request.Cookies("cookietest") <"49" Then
Response.Redirect("err.asp?e=1")
End If
%>
I have a user that insists he has cookies enabled, yet he keeps getting
redirected to my error page which suggests he does not have cookies enabled.
What could cause this? Is the above too simple for all circumstances?
Is there more extensive code that I could setup on a hidden page where I can
send users to get read out on how they actually have their browsers setup?
i.e. Run a test on their browser and the results are emailed to me.
View Replies
View Related
I'm sure I have missed something but I can't see what...
I create two cookies on one ASP page as follows:
response.cookies("Errors") = "Must not be blank"
response.cookies("User")("Mem_Username") = response.write(M_Mem_Username)
response.cookies("User")("Contact_N") = response.write(M_Contact_N)
This page then calls the second ASP page which then reads the cookies:
E_Contact_N = request.cookies("Errors")
C_Contact_N = request.cookies("User")("Contact_N")
C_Mem_Username = request.cookies("User")("Mem_Username")
When I then use response.write (for example, response.write(C_Mem_Username)) to view the contents of the variables, there is nothing there.
As I say, I am still developing the site and so am using IIS on a Win XP Pro machine (local host)
What I am doing wrong?
View Replies
View Related
I know very little about ASP and ASPX pagfes but i inherited a web site done by a guy who knew just a little more than me and I've worked around things with my knowledge of HTML and Javascript, as well as added on to the web site using Cold Fusion. But I am at a point that I need to be able to do more.
I have a ASPX page with a Log In button that I don't want see if a certain cookie exists. Is there a way to test for that cookie on the page and display or not display something based on that test?
View Replies
View Related
my system is at testing phase. how do i test my system to check its security especially at the login page? i am running it at localhost. i have tried sql injection but nothing happened. i just saw the invalid login username or password error only.
View Replies
View Related
I have created a page that will allow all web based errors generated to be logged, like IIS errors 404, 403,401, 400.
I am now testing to see if the correct files are being displayed when the errors occur. I am able to replicate the 404 err as well as the 403 error, bu I cannot test the 401 or 400 errors. Does anyone know how to do this?
I tried using err.raise, but it doesnt seem to work, unless i m doing something wrong.
View Replies
View Related
How can I test the scalability of my website, e.g how can I check if my website still performs correctly when there are 300 people visiting?
View Replies
View Related
I need to test ASP pages at home before uploading them (no net connectiona t home, only here at uni and I need the site owrking before I transfer it).
The ASP pages are written, PWS is installed (except for some file that had an error - but that didn't install last time and everything worked fine then).
Where do I put the ASP pages and DB and how do I set up a connection between them? The pages run in IE at the moment but no data is pulled onto them from the DB.
View Replies
View Related
May I have the list of good ASP testing tools available on the market?
View Replies
View Related
When I type in the url...URL I get an error saying I'm unauthorized to view the page?
View Replies
View Related
I've been given a task to develop an automated unit testing framework for a project I'm workin on...
I've spotted ASPUnit on sourcesafe... but it doesn't seem to handle situations when we have global variables, session stuff etc...
I was thinking of doing something to a screenscrape and just do a file comparison... actually, there ARE ways to do this aren't there? I've heard/read about that before.. some HTTP objects or something that would allow me to call an asp page, and grab the output as a string.. rather than have the output go to a screen... anyone able to point me i the direction of this kinda stuff?
View Replies
View Related
I need to test if cookies are enabled in the browser. I disabled cookies in my browser and rebooted my browser, yet the below code still writes a cookie and reads it correctly.
<%
Response.Cookies("smcookietest") = ("8")
Response.Cookies("smcookietest").Expires = Date + 2
%>
<%
If Request.Cookies("smcookietest") <> "8" Then
Response.Redirect("error.asp?error=19")
End If
%>
<%=Request.Cookies("smcookietest")%>
View Replies
View Related
I am developing a Testing Checklist for the Programmers in my company. As i am not a programmer, Can you guys help me.
I am looking for some common Code testing steps which a programmer should do when he is testing his web application
These testing checklist could include common mistakes programmers do or any special coding error which they might receive when they are testing their web application.
View Replies
View Related
I had a mild hack of the default windows web page in inetpub because I was running IIS whilst my DSL connection was on. Ever since,I have disconnected the DSL before running IIS.
Could anyone give me advice on running IIS safely as a local testing server
(for asp pages) whilst online? I have to admit that I run an admin account (win2000) so I know this is one thing I should change
View Replies
View Related
I'm running IIS under windows XP, and developing an ASP web page locally. My problem is that I can't get it to work without connecting to the internet. Am I doing something wrong, or does ASP require a redundant connection in order to run?
I have a page that simply displays the current time. If I'm connected and press the refresh button the displayed time is updated. If I disconnect, then the time displayed remains unchanged even after hitting the refresh button.
View Replies
View Related
May I have the list of good ASP testing tools available on the market?
View Replies
View Related