Jersey,
You are correct you do not need to place a / at the end. No big deal but what is all this it doesnt know what folder to pick
$imgurl = "[img]{$data_dir}/$ppcat/{$user['U_Number']}{$photo_name}-med{$theext}[/img]";
The above is the default photopost format
data/whichcat/usernumberphotonameextention