@hq320 cool script but your regex is not good, what if there is another server instead of i28? and u dont need to use BINARYTRANSFE or cookies in curl.
here one improvment in your script.
PHP Code: 
 preg_match('#\[IMG\](.*)\[\/IMG\]#'$data$matches); 
$image $matches[1];