Update the gallery shortcode

Now the images does not have to be attached to the specific post/page as the shortcodes goes in.

Someone may have to look a bit closer to the code. I'm not a php-guru, but it took me a few hours to work this out. Anyway, I hope this contributes to the project.