Inline Image Hack Continued

Inline Image Hack Continued

Continuing with the markdown/pictpress hack, this post with serve as a to-do / issues list.

  • Download MDIH 0.3, the MDIH 0.3 changes, or follow the development history.

  • In version 0.2, note that the syntax has changed, so you will have to update your old posts if you were using 0.1. But no one was, so I doubt it will be a problem :-)

  • done I want to add a special popup value for the link url, which would automagically put the full size image in its own tasty window. I’m not sure where I would insert the javascript code for this in a portable way. For all I know, there is built-in javascript already in WordPress, so I should do some more digging.

  • done What about GIFs? So far, this is JPEG only! I can either snoop the file’s extension, or maybe there is some kind of “magic number” routine that can identify filetype in PHP. That would save me some string processing work :-)

  • fixed I just realized that I have the syntax kind of backwards. I should put the link as the second parameter, and have all the image control in the first link. This came to me when I found myself wishing I could use the global link defs in markdown. Maybe something like… !@[image_uri](url "title")(L 120) !@[image_uri][id](L 120) …where the parameters get their own little extension parens. I think I can write a regex that treats that last as optional, and it can default to a standard left-justified thumbnail. Or maybe I don’t use regex at all on the individual backreference level and just get the entire match, and EXPLODE it. That would make life easier :-)

  • done Use global link defs, because I love ’em.

  • done It would be useful to have a CLEAR ALL indicator. The half-assed way I’m designating alignment (due entirely to my weak grasp of regular expressions) could be extended to support this, perhaps by using lower-case to mean “float” and upper-case to mean “clear, then float”.

  • handled The way alignment and width are glommed together is because I wasn’t sure how to handle extra or out-of-order parameters gracefully using regular expression references, so I put them into one thing. Since they are all required, though, I could just have a separate alignment parameter. Though I kind of like them as one thing. I don’t want to require too many parameters, because that defeats the purpose of Markdown.

    If I use syntax changes, I could introduce longer keywords, but that gets away from the spirit of markdown. Maybe L for left float, and LB for left float break?

  • Put a quick upload form on the Write and Edit admin pages, so they are automatically uploaded to the right directory? It should be possible to hook into the post page, since I’ve seen other plugins claim to do it. This would simplify uploading, especially if the upload manager automatically uses the post_id to create a containing directory. That would totally rock. The links inside the markdown syntax could probably just access files by name, and you’d never have to use a directory again.

  • done Change the cache file naming scheme so cache comes FIRST in the name. I thought at first that I wanted files to sort alphabetically so related files were in a nice block, but that kind of sucks when you are looking for just the important originals. Also, put them in their own directory.

2 Comments

  1. doozer 20 years ago

    this is exactly what i need to do before implementing a blog using wordpress.  when can i get the hack?
    ——-

  2. dave 20 years ago

    I added a download link with some instructions on how it works at the top of this post. I probably will come back and tweak this later…it will probably break the current syntax, so be forewarned.