Topic: img tag showing the source bbcode instead of the image

I migrated a forum from phorum to punbb with this script I wrote. It worked fine but some images show the bbcode instead of the images. If i edit the message and then submit again without any changes then the image shows.
I noticed that so far that happen only when the IMG tags are in capitals, but i am not sure about this yet.

Can anybody give a look on the script and tell me why am i having this problem?

Re: img tag showing the source bbcode instead of the image

Because preparse_bbcode is called when you post/edit, which turns all caps into all lower case?

Re: img tag showing the source bbcode instead of the image

i guessed it should be something like that, does sqlite has any find and replace solution?