If filter is an array of chosen categories you can use IN
in your query:
$filterIn = implode("','",$filter);
SELECT * FROM edt_images
WHERE category1 IN ('$filterIn')
OR category2 IN ('$filterIn')
OR category3 IN ('$filterIn')
OR category4 IN ('$filterIn')
OR category5 IN ('$filterIn')
OR category6 IN ('$filterIn')
Note however you shouldn't be using unsanitised user input in an SQL query.