Non so se ho capito.
codice:
$stringa = '[img=12]';
preg_match("/(=)(.*)(\])/",$stringa,$mth);
echo $mth[2].'/...';