Forums

This topic is locked

Default Image in place when no image is available

Posted 16 Jan 2002 17:32:21
1
has voted
16 Jan 2002 17:32:21 Zain Magsi posted:
Hi,

I have a access db for my app which displays records and a corresponding image for a record on an asp page.

The images are in a directory of their own and the path to the images in in an access db field. How do I get the application to display a default image when there is no image available for a partiqular record.

I made the app in UD.

Thanks,

Zain

Zain Magsi

Replies

Replied 16 Jan 2002 17:59:38
16 Jan 2002 17:59:38 Kent Steelman replied:
How about placing the default image in a directory and in your database place that path way as the default value of the field that will point your application to the image. This way when data is added without the newimage pathway then the default image pathway will automatically be samed to the database field. One other suggestion is to make the field a mandatory field in the database. This way it is not erased at some point in time in the future.

Wm. Kent Steelman
Replied 17 Jan 2002 07:13:30
17 Jan 2002 07:13:30 I Mahomed replied:
another way would just be to check if the field is empty "" if it is load default else continue and include the image

i actually use both, i make the default value the id of an image thats 1px x 1px and transparent and check to see if its ""

Replied 17 Jan 2002 21:52:26
17 Jan 2002 21:52:26 Andrew Ross replied:
I had a similar problem last month. This is the code that worked for me. It shows an image only if one is available.

<td>
<%If(YourRecordSet.Fields.Item("YourTableColumnName".Value)<> "" Then %>
<img src="images/<% = YourRecordSet.Fields.Item("YourTableColumnName".Value %>">
<% Else %>
&nbsp
<% End If %>
</td>

See the topic below for more info:

www.udzone.com/forum/link.asp?TOPIC_ID=13176

Cheers,

Andrew
Replied 19 Jan 2002 23:18:33
19 Jan 2002 23:18:33 David Behan replied:
What I do for this is the following:

Set the default value of the field picture to "none.jpg". I have no file called none.jpg but if you did you could place it into the same directory as the others.

If not you can use a conditional region as follows:

In English: Show if the current records picture field is not equal to "none.jpg".

Extension: Use extension "conditional region". You can find this if you search in the udzone main site.

Actual Script:

<% If rsProperty.Fields.Item("pic_sm".Value <> ("none.jpg" Then 'script %>
<img src="images/propertysm/<%=(rsProperty.Fields.Item("pic_sm".Value)%>" width="120" border="1" alt="<%=(rsProperty.Fields.Item("address".Value)%>" align="right">
<% End If ' end If rsProperty.Fields.Item("pic_sm".Value <> ("none.jpg" script %>


That should work for you!!!

---------------------
David Behan - bmor.com

Edited by - davidbehan on 19 Jan 2002 23:20:27
Replied 26 Feb 2002 16:46:15
26 Feb 2002 16:46:15 scre wdanger replied:
Lets make life easier
Download the free extension
"AlternativeImage.mxp"
from the following URl:
www.udnewbie.com/Extensions/index.cfm
Click the dynamic image and then the extension. Choose the alternative image.
Thats it.
cheers



Reply to this topic