How to optimise MySQL query that uses dependent subquery
Instead of using a sub query you could use a LEFT JOIN.

That way you negate the need for a sub query which is being looked at for each image.

LEFT JOIN
        seen
    ON
        seen.image_id = images.id
    AND
        seen.user_id = $user_id


Then only get rows that haven't been joined.

WHERE
   seen.id IS NULL