Try this:
In the above code find:
PHP Code:
FROM {$pixelpost_db_prefix}catassoc AS CAT
INNER JOIN {$pixelpost_db_prefix}pixelpost AS PIX ON (CAT.image_id = PIX.id)
Replace with:
PHP Code:
FROM {$pixelpost_db_prefix}categories AS CAT
INNER JOIN {$pixelpost_db_prefix}pixelpost AS PIX ON (CAT.id = PIX.id)
ALSO
Find:
PHP Code:
'category="'.utf8_encode($row2['category']).'"/>'.PHP_EOL;
replace with:
PHP Code:
'category="'.utf8_encode($row2['name']).'"/>'.PHP_EOL;
Disclaimer: The above code has not been tested.