We were having 'issues' with Yahoo not accepting what seemed to be perfectly valid JPEGs. Investigating them with identify (from imagemagick) found that they seemed to have extra fields with odd characters. It seems that Photoshop and other image editors can't resist putting crap in there. Presumably Yahoo was choking on these. Browsing the web for a bit found this little tool (comes with both a GUI and commandline program). It does a great job stripping all the unwanted stuff out of JPEGs and has saved the day.