Adding custom image upload to Pagedown using PHP

One of my personal project using Pagedown for the markdown editor, so this is a working solutions and not just an example. [...]