you have a table users containing all data concerning your users (primary key: userid)
you have a table images with primary key imageid
now you create a 3rd table called votes with three columns:
userid | imageid | points
primary key is the combination of userid and imageid
if user with id 75 (stored in session?) rates image with id 789 and gives it 3 points your table looks like
75 | 789 | 3
to get the pic's rating try something like this (in phpmyadmin to see the results)
SELECT
i.imageid, i.source,
AVG(v.points) rating
FROM
images i
LEFT JOIN votes v ON i.imageid = v.imageid
GROUP BY
i.imageid, i.source