I was having the exact same problem but after some research i figured it out:
this line
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
should look to something like this:
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '/width="100″ height="100″/',$postOutput);
Hope it helps if you haven’t already figured it out or if someone else have this problem as well.