Never illegal.
Just that sites like Geocities, and Angelfire, dont let you do that.
You can solve this by renaming your image file to a .txt
For example, say I have HOTSLUT.jpg
I would just rename it to HOTSLUT.txt
Then I would link to
http://www.geocities.com/xXx/HOTSLUT.txt with the IMG tag
It's all good