Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: not2easy

Message Too Old, No Replies

Image Gallery - Failed w3c Validation

   
10:09 pm on May 1, 2008 (gmt 0)

10+ Year Member



Hello,

I have an image gallery on a web site I am creating. It looks great, but it does not pass w3c validation. Just the images failed validating. I have 30 images and 30 errors. I'll post some of the errors. My doc type is Html 4.01 strict. My gallery page consist of 30 "thumb" images. You click on the thumb image and an "img.html" page will appear with the larger image. Is there a way to fix this problem using "CSS?" Thanks in advance for your help.

Validation Output: 30 Errors
Line 134, Column 37: "IMG" is not a member of a group specified for any attribute.
<a href="large_picts/img22.html" img src="image2/theater.jpg" target="_self">&#9993;

Line 134, Column 41: there is no attribute "SRC".
<a href="large_picts/img22.html" img src="image2/theater.jpg" target="_self">&#9993;

Line 136, Column 22: "IMG" is not a member of a group specified for any attribute.
<a target="_self" img src="image2/theater2.jpg" href="large_picts/img23.html">&#9993;

Line 140, Column 22: "IMG" is not a member of a group specified for any attribute.
<a target="_self" img src="image2/SS.jpg" href="large_picts/img3.html">&#9993;

Line 142, Column 22: "IMG" is not a member of a group specified for any attribute.
<a target="_self" img src="image2/dining4.jpg" href="large_picts/img4.html">&#9993;

Line 145, Column 22: "IMG" is not a member of a group specified for any attribute.
<a target="_self" img src="image2/la10.jpg" href="large_picts/img6.html">&#9993;

Thanks in Advance for your help,
<snip>

[edited by: engine at 8:43 am (utc) on May 2, 2008]
[edit reason] see TOS [/edit]

11:29 pm on May 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Senmar50
You've accidentally stuck the "a" link and "img" tags together into one tag (!) Should be something like:

<a href="large_picts/img22.html" target="_self"><img src="image2/theater.jpg"></a>

You might want to add height and width attributes on your image tags and, for accessibility/user friendliness, alt attributes too, for example:

<img src="image2/theater.jpg" height="100" width="200" alt="your brief description of the image">
7:52 pm on May 5, 2008 (gmt 0)

10+ Year Member



Hi Mattur,

Thanks so much for your help. My pages passed w3c validation. Question: Would it be wise to place an (index.html) page in the images folder for security purposes? Visitors won't be able to see the content, if they click on the image directory. Should the index.html just say "KEEP OUT" or you have entered a secure area of this web site.

Thanks Again,
SenMar50

7:54 pm on May 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or you could use .htaccess to protect your directories.
7:57 pm on May 5, 2008 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Be aware that your image URLs are relative. This can cause problems, as it is the browser that resolves the path to that file.

I prefer to use URLs that begin with a "/" and therefore count from the root.

8:22 pm on May 5, 2008 (gmt 0)

10+ Year Member



Thank you both....

My images url's are relative. They do begin with "../images".
I have to read up on the (.htaccess). I remember trying the (.htaccess) in the past on a folder, and it didn't work; or I just screwed up. I'm going to read up on it, and give it a try. Thanks again. You folks are always on point.

SenMar50

10:51 pm on May 5, 2008 (gmt 0)

10+ Year Member



Hi,

I tried the .htacess method, and the content of the folder is still exposed.

Here is my .htacess file. I placed the file in the image folder.

<Files .htaccess>
ErrorDocument 404 "<b>Page Not Found</b><p /><br /><a href="../index.html">Return to the homepage</a>
order allow,deny
deny from all
</Files>

I tried another one:

<Files .htaccess>
ErrorDocument 403 /403.html
ErrorDocument 400 /400.html
ErrorDocument 500 /500.html
order allow,deny
deny from all
</Files>

What am I doing wrong..
Thanks in advance,
SenMar50 (P.S. The "index.html" works perfectly) :-)

12:45 am on May 6, 2008 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



For links ../ is not the same as /. I use / only.

.

Does this do anything useful for you...

# Protect certain files from being web accessible.
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README*

As far as I know, the ErrorDocument directives shouldn't be anywhere near those either...

1:12 am on May 6, 2008 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Note that you will get a fuller answer to the .htaccess questions in the Apache forum [webmasterworld.com], but you should not be wrapping the rules in a
<Files>
container, as that would limit the scope th the .htaccess file only, which would make no sense. :) To turn off all directory indexes, you can just add:

Options -Indexes

to a root-level .htaccess file. :)

9:44 pm on May 6, 2008 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



adding to mattur
<img src="image2/theater.jpg" height="100" width="200" alt="your brief description of the image">

you also need adding img title
12:36 am on May 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Placing an index.html file only prevents a listing of the files in the folder. index.html and a few others depending on the server configuration are default pages served when someone types in www.example.com/somefolder/ if there is no default page there the contents of the directory will be shown or as encyclo pointed out you could just turn this option off for all folders.

In any case none of these methods would prevent anyone from accessing the images directly via a correct URL. Using index.html is just a easy way to prevent the directory listing.

1:38 am on May 7, 2008 (gmt 0)

10+ Year Member



Thanks for the help everyone!

Thecoldman, I do understand what you're saying about index.html as my method for preventing folder content from being indexed. But, that's all I knew how to do....until "Limbo" introduced .htaccess to me. I read up on the subject and was able to prevent my files from being indexed.

Here's what I did:

Created a .htaccess file; removed the "txt" extention before uploading to server.

My .htaccess file: (in image folder)

<Files .htaccess>
order allow,deny
deny from all
</Files>

# Protect certain files from being web accessible.
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README*
IndexIgnore *
/////////////////////////////////////////

Results when folder clicked:

Index of /myweb/myimages
Apache/x.x.xx Server at www.#*$!#*$!#*$!#*$!.com Port xx

/////////

I know I have a lot more to learn about .htaccess, but this is a start, and I thnk you all.

Sincerely,
SenMar50

12:17 am on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Add this too:

Options -Indexes