meaningful web image filenames- max length

macmesser

macrumors 6502a
Original poster
Aug 13, 2012
845
70
Long Island, NY USA
I'm replacing an Extensis Portfolio image database on the web with one embedded in an e-commerce system and I'm cleaning up the old database in preparation. One of the preps I'm doing on the old files is to rename them with meaningful English names, for which I'm writing an AppleScript. My question is how long can I or should I go with a filename phrase before I start breaking web pages or image links? Remember, these are file names not page titles. Obviously, the more information the better if no harm is done. Should I target a filename length of say 40-50 characters? Would 70 chars be too long? Any insights appreciated.
 

jamietshaw

macrumors member
Sep 25, 2009
84
15
UK
Does the filename get shown in the URL? IE seems to limit the URL length to 2048 characters or fewer, while other browsers may allow more. So, from a technical point of few 70 characters sounds fine. Shorter names might be better if you except users to share links in some way, or reference them in printed documents.

The operating system running your web server will have some sort of limit on filename length, but again it will be much more than 70.

Longer names might help search engines find the pictures.

Longer names will slow down your page load time slightly, if you have an HTML page referencing lots of long filenames.
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,872
2
Alexandria, VA, USA
max 70 sounds about right to me, too and convert special characters and spaces to underscores and allow dashes, then strip existing ext if any and check mime-type and add the proper dot extension through code if processing an upload server side. Makes it easily readable by humans and machines (i.e. semantic). The extension handling is optional, of course, it just is a safety check to ensure to extension is correct, makes sense to do this in the kind of project you are undertaking so I made mention of it.
 

macmesser

macrumors 6502a
Original poster
Aug 13, 2012
845
70
Long Island, NY USA
max 70 sounds about right to me, too and convert special characters and spaces to underscores and allow dashes, then strip existing ext if any and check mime-type and add the proper dot extension through code if processing an upload server side. Makes it easily readable by humans and machines (i.e. semantic). The extension handling is optional, of course, it just is a safety check to ensure to extension is correct, makes sense to do this in the kind of project you are undertaking so I made mention of it.
Thanks to both of you. I had decided on a length of 70 characters and will build them from custom fields used to record various attributes such as subject, artist, title, etc. in order to provide some content for image searching.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.