Attribution is a legal requirement when using Creative Commons licenced material. The "BY" in CC BY means "use with attribution". Works in the public domain do not strictly require attribution, however sources should always be referenced to avoid plagiarism.
When attributing a work under a CC licence you should:
- Credit the creator;
- Provide the title of the work;
- Provide the URL where the work is hosted;
- Indicate the type of licence it is available under and provide a link to the licence (so others can find out the licence terms); and
- Keep intact any copyright notice associated with the work.
The following is an example of attributing a creative commons image.

"Waiting for Spring" by Christian Kortum is licensed under CC BY-NC-SA 2.0
More examples and best practice for CC attribution is on the Creative Commons wiki.