Add a separate constraint for both columns:
CREATE TABLE MyTable( user_id INTEGER, image_id INTEGER, [...], UNIQUE(user_id, image_id))