It's hard to make sense of your code. Some of the pictures are partially minified which makes it harder to understand. That error means either the 'width' and 'height' properties of the thing you are passing as the texture data are missing, or are <= 0, so check you are passing something valid to create a texture from.
Edit: oh, some of your C3 runtime code still references C2 runtime things which do not exist. For example texture_img does not exist in the C3 runtime. Check the SDK documentation. Also you should run this code in the debugger, that would make simple mistakes like this obvious.