Forums

ASP

This topic is locked

If file exist else another file

Posted 12 Sep 2002 05:22:02
1
has voted
12 Sep 2002 05:22:02 Talal Nabil posted:
Hi.
<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

Basically i want to do something like,

if xxxxx.jpg exist then imgsource=xxxxx.jpg else imgsource=NoImage.jpg

Thanks for your suggestions,
ToTTi <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

Replies

Replied 12 Sep 2002 09:12:04
12 Sep 2002 09:12:04 Vince Baker replied:
Try this:

&lt;%
Dim imgsource, displayimg
displayimg= "NoImage.jpg"
%&gt;
&lt;%
If imgsource &lt;&gt; "" or Null Then
displayimg = rsYour_Recordset.fields.item("Your_Image_Field".value
End If
%&gt;

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting

Edited by - bakerv on 12 Sep 2002 09:13:18
Replied 12 Sep 2002 21:09:04
12 Sep 2002 21:09:04 Talal Nabil replied:
<img src=../images/dmxzone/forum/icon_smile_blackeye.gif border=0 align=middle>

Thanks bakerv,

But it didn't work, What I exactly want is to check the images directory and if the file exist then display it ELSE display another picture

I don't know how..... Please help <img src=../images/dmxzone/forum/icon_smile_blackeye.gif border=0 align=middle>
Replied 13 Sep 2002 09:05:28
13 Sep 2002 09:05:28 Vince Baker replied:
Are you saving the image information in a database or do you just have a link to an image on the page?

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 13 Sep 2002 09:42:05
13 Sep 2002 09:42:05 Viktor Farcic replied:
<pre id=code><font face=courier size=2 id=code>&lt;%
Set File = CreateObject("Scripting.FileSystemObject"
ImagePath = Server.MapPath("images/"
ImagePath = ImagePath & "\" & strImageName
If FileExists(ImagePath) Then
.....
Else
.....
End If
%&gt;</font id=code></pre id=code>


Viktor Farcic
www.farcic.com
TalkZone Manager
Replied 13 Sep 2002 09:47:59
13 Sep 2002 09:47:59 Talal Nabil replied:
OK bakerv,

I'll tell u the story.....
I'm buliding an e-commerece web site, at the database there is a field called image name which is the ProductID+.jpg
Some of the products do have images stored at a directory called images/store and others do not have images yet but at the database they have an image name.....

This is my story, I want to check if the file really exist at images/store or not
if yes it shows the image (ProductID.jpg) else show the picture comingsoon.jpg

Do u have a solution or any suggestion

Totti <img src=../images/dmxzone/forum/icon_smile_dead.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_sleepy.gif border=0 align=middle>
Replied 13 Sep 2002 10:09:36
13 Sep 2002 10:09:36 Talal Nabil replied:
WOW <img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>

This is great.... IT WORKED OUT

I'm really out of words <img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle>
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Replied 13 Sep 2002 10:32:43
13 Sep 2002 10:32:43 Talal Nabil replied:
Hey Farcic
i have one more question....
how can i remove that blue box around the pictures coz the pictures are hyper linked

Thank you once again for your great support and help

Totti
Replied 13 Sep 2002 10:54:30
13 Sep 2002 10:54:30 Vince Baker replied:
in the properties box change the border thickness to 0

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 13 Sep 2002 11:21:33
13 Sep 2002 11:21:33 Talal Nabil replied:
Actually, the border is set to 0
This blue border is because of the link
I mean &lt;a herf .......&gt; image &lt;/a&gt;

will u help me to remove this

Totti
Replied 13 Sep 2002 11:26:56
13 Sep 2002 11:26:56 Vince Baker replied:
If you make an image into a hyperlink you get a blue border around it. You must enter 0 in the border property box to remove it. Leaving the box blank will leave a border.

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 13 Sep 2002 11:48:02
13 Sep 2002 11:48:02 Talal Nabil replied:
YESSSSSSSSS...

<img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle> for u Vince and also for Victor

U 2 are perfect and MASTERS... <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

Everything is more than fine

Thanks for both of u

Totti <img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>

Reply to this topic