Forums

ASP

This topic is locked

Alt text in an image extracted from a database

Posted 20 May 2006 03:47:16
1
has voted
20 May 2006 03:47:16 John Marsden posted:
Hi All,
I'm developing an ASP site using Dreamweaver that will contain a directory of organisations involved in disabilities. It is essential that the site be accessible and that all images contain Alt text. Each entry in the directory will list an organisation's name, address, telephone number, etc. Some of the organisations listed also require images, namely, logos and symbols. The images load fine but without (obviously) any Alt text. How can one get Alt text to associate with a dynamically generated image? I realise that I will require a field in the database containing the text, but I'm stuck as to how to get the text contained in the field into the alt attribute of a dynamically generated image tag. I would be grateful for any assistance/advice to help me resolve this?

Thanks John

Replies

Replied 21 May 2006 02:56:35
21 May 2006 02:56:35 micah santos replied:
can you show us the code where you display those dynamic images?
Replied 21 May 2006 04:12:58
21 May 2006 04:12:58 John Marsden replied:
The code for the row containing an organisation's name and associated logo (orgLogopath) is:
<pre id=code><font face=courier size=2 id=code>
&lt;td colspan="2" align="left"&gt;&lt;h3 class="style2"&gt;&lt;%=(rsOrganisations.Fields.Item("orgName".Value)%&gt; &lt;img src="&lt;%=(rsOrganisations.Fields.Item("orgLogopath".Value)%&gt;" /&gt;&lt;/h3&gt;&lt;/td&gt;
</font id=code></pre id=code>
Replied 21 May 2006 04:23:47
21 May 2006 04:23:47 micah santos replied:
are those image files already uploaded in your server and these are just basically
a path to your directories?

e.g.

is this the field value?

&lt;%

rsImagePath = "domain.com/images/image.jpg"
%&gt;
Replied 21 May 2006 04:28:24
21 May 2006 04:28:24 micah santos replied:
why not update your records and just add ALT="textgoeshere"

you should have something like this in your database:

&lt;img src='images/LOGO1.jpg' alt='This is Logo1'&gt;

instead of separating the &lt;IMG&gt; tag, why not include it in your database?

Replied 21 May 2006 07:02:33
21 May 2006 07:02:33 John Marsden replied:
Thanks for that it got me on the right track though I found that putting tags into the database field didn't work as the ASP was also creating tags and the code was rendered as:

<pre id=code><font face=courier size=2 id=code> &lt;img src="&lt;img src='images/LOGO1.jpg' alt='This is Logo1'&gt;" /&gt;</font id=code></pre id=code>


However, I found that It worked with the alt attribute as long as I placed a " at the end of the image attribute and the start of the alt attribute. i.e.

<pre id=code><font face=courier size=2 id=code>
images/gaddum.gif" alt="This is Logo1 </font id=code></pre id=code>

Again thanks John M
Replied 21 May 2006 18:55:27
21 May 2006 18:55:27 micah santos replied:
you did it wrong b'coz you used the &lt;IMG&gt; tag twice...

what I meant by that was to just display to record including the &lt;IMG&gt; tag:

&lt;%

rsdate("imagePath" = "&lt;img src='images/LOGO.jpg' alt='logo 1'&gt;"

response.write rsdate("imagePath"

%&gt;

anyway, at least you have figuired it out.

cheers!
Replied 22 May 2006 15:41:30
22 May 2006 15:41:30 John Marsden replied:
LOL - rightfully put in my place.

Thanks for the follow up. My ASP knowledge is not great and I've done most of the work using Dreamweaver and following tutorials. So I can blame the folks at Macro..! -whoops- Adobe. But I see what you are pointing out to me and have learned from it. I'll be going about the task differently next time taking account of your comments.

Cheer's John

Reply to this topic