flipandboef
Posts: 107
|
| Posted: 12/19/2006, 12:26 PM |
|
Ok here is a question I have...
I have in my custom code in the Before Show event on an Image Link:
If Prods.Photo.Value = "" then Prods.Photol.Value ="NoImg.gif"
Image is of course stored in the database path..
This workes all great when there is no data entered in the database for the image.. (It shows nicely the NoImage on the site..
However, I would like that this situation remains the same, but like to also add that when a picture cannot be found, it also will show up this NoImage...
Example:
in the database the picture field has: "" --> the NoImage shows up fine
in the database the picture field has 16.jpg, but this picture does not exist on the server --> like to show in this case also the NoImage...
Is this possible to accomplish? and if so, anyone who can help me with the code for it?
Thanks
Note:
Using --> ASP / CCS 3.1 / MS-Access
|
 |
 |
flipandboef
Posts: 107
|
| Posted: 12/19/2006, 2:04 PM |
|
ok I have found some code in the forum.. (1st try i didn't find anything...)
And now am trying to use this code:
Dim filespec, fso
filespec = (Prods.Photo.Value)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(Server.MapPath(filespec) ) Then
Rugs.PhotoSmall.Value = filespec
Else
Prods.Photo.Value = "NoImg.gif"
End If
Problem however is: now all my pictures are showing up as the NoImg.gif!
In the database I have a path in the Picture field, that I cannot avoid...
The goal is to replace them via the Fileupload, but with over 8000 pictures, this is gonna take some time...
Till that time, in the database field for the picture I have for example:
bigimage/13805.jpg
(so in the database folder on the server there's a folder bigimage)
later this will be changed in the DB to 13805.jpg and the file will be stored in the database folder directly, via the FileUpload...
ANyone who can tell me what goes wrong in my code?
Thanks
|
 |
 |
flipandboef
Posts: 107
|
| Posted: 12/20/2006, 8:02 AM |
|
ok I found my mistake.. I forgot a "/" in my code..
This is the final code I used:
Dim filespec, fso
filespec = (Rugs.PhotoSmall.Value)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(Server.MapPath("/" & filespec) ) Then
Rugs.PhotoSmall.Value = filespec
Else
Rugs.PhotoSmall.Value = "NoImg.gif"
End if
|
 |
 |
|